CacheAlg
Abstract algebra describing the operations a cache can perform
- Type Params
- F
The effect monad in which all cache operations will be performed.
- V
The value of types stored in the cache.
Value members
Abstract methods
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
- Value Params
- f
A block that computes the value
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
The cache key
- ttl
The time-to-live to use when inserting into the cache. The cache entry will expire after this time has elapsed.
- Returns
The value, either retrieved from the cache or computed
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
- Value Params
- f
A block that computes the value wrapped in a container
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
The cache key
- ttl
The time-to-live to use when inserting into the cache. The cache entry will expire after this time has elapsed.
- Returns
The value, either retrieved from the cache or computed
You should call this when you have finished using this Cache. (e.g. when your application shuts down)
You should call this when you have finished using this Cache. (e.g. when your application shuts down)
It will take care of gracefully shutting down the underlying cache client.
Note that you should not try to use this Cache instance after you have called this method.
Get a value from the cache
Get a value from the cache
- Value Params
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
The cache key
- Returns
The appropriate value, if it was found in the cache
Insert a value into the cache, optionally setting a TTL (time-to-live)
Insert a value into the cache, optionally setting a TTL (time-to-live)
- Value Params
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
The cache key
- ttl
The time-to-live. The cache entry will expire after this time has elapsed.
- value
The value to insert
Remove the given key and its associated value from the cache, if it exists. If the key is not in the cache, do nothing.
Remove the given key and its associated value from the cache, if it exists. If the key is not in the cache, do nothing.
- Value Params
- keyParts
data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.