Expiring Cache
ExpiringCache is a simple cache implementation that stores key-value pairs with an expiration time. It automatically removes expired entries and can be used to cache data that is only valid for a certain period.
Example:
val cache = ExpiringCache<String, String>(plugin, 60) // 60 seconds expiry time
cache.put("key", "value")
val value = cache.get("key") // Returns "value" if within expiry time
cache.remove("key") // Removes the entry
cache.stop() // Stops the cleanup task
Content copied to clipboard