scalacache
Type members
Classlikes
An abstract implementation of Cache that takes care of some things that are common across all concrete implementations.
An abstract implementation of Cache that takes care of some things that are common across all concrete implementations.
If you are writing a cache implementation, you probably want to extend this trait rather than extending Cache directly.
- Type Params
- K
The type of keys stored in the cache.
- V
The type of values stored in the cache.
Abstract algebra describing the operations a cache can perform
Abstract algebra describing the operations a cache can perform
- Type Params
- F
The effect monad in which all cache operations will be performed.
- K
The type of keys stored in the cache.
- V
The type of values stored in the cache.
Abstract algebra describing the operations a cache can perform
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.
A cache entry with an optional expiry time
A cache entry with an optional expiry time
- Companion
- object
Configuration flags for conditionally altering the behaviour of ScalaCache.
Configuration flags for conditionally altering the behaviour of ScalaCache.
- Value Params
- readsEnabled
if false, cache GETs will be skipped (and will return
None
)- writesEnabled
if false, cache PUTs will be skipped
- Companion
- object
Sealed HashingAlgorithm trait to prevent users from shooting themselves in the foot at runtime by specifying a crappy/unsupported algorithm name
Sealed HashingAlgorithm trait to prevent users from shooting themselves in the foot at runtime by specifying a crappy/unsupported algorithm name
The name should be a valid MessageDigest algorithm name.Implementing child classes/objects should refer to this list for proper names:
http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#MessageDigest
MD5 returns 32 character long hexadecimal hash strings
MD5 returns 32 character long hexadecimal hash strings
SHA1 returns 40 character long hexadecimal hash strings
SHA1 returns 40 character long hexadecimal hash strings
SHA256 returns 64 character long hexadecimal hash strings
SHA256 returns 64 character long hexadecimal hash strings
Value members
Concrete methods
Wrap the given block with a caching decorator. First look in the cache. If the value is found, then return it immediately. Otherwise run the block and save the result in the cache before returning it.
Wrap the given block with a caching decorator. First look in the cache. If the value is found, then return it immediately. Otherwise run the block and save the result in the cache before returning it.
Note: If ttl is set to None, the result will be stored in the cache indefinitely.
- Type Params
- F
The type of container in which the result will be wrapped. This is decided by the mode.
- V
the type of the block's result
- Value Params
- cache
The cache
- f
The block to run
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
Data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.
- mode
The operation mode, which decides the type of container in which to wrap the result
- ttl
The time-to-live to use when inserting into the cache. If specified, the cache entry will expire after this time has elapsed.
- Returns
The result, either retrived from the cache or returned by the block
Wrap the given block with a caching decorator. First look in the cache. If the value is found, then return it immediately. Otherwise run the block and save the result in the cache before returning it.
Wrap the given block with a caching decorator. First look in the cache. If the value is found, then return it immediately. Otherwise run the block and save the result in the cache before returning it.
Note: If ttl is set to None, the result will be stored in the cache indefinitely.
- Type Params
- F
The type of container in which the result will be wrapped. This is decided by the mode.
- V
the type of the block's result
- Value Params
- cache
The cache
- f
The block to run
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
Data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.
- mode
The operation mode, which decides the type of container in which to wrap the result
- ttl
The time-to-live to use when inserting into the cache. If specified, the cache entry will expire after this time has elapsed.
- Returns
The result, either retrived from the cache or returned by the block
Get the value corresponding to the given key from the cache.
Get the value corresponding to the given key from the cache.
- Type Params
- F
The type of container in which the result will be wrapped. This is decided by the mode.
- V
The type of the corresponding value
- Value Params
- cache
The cache
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- mode
The operation mode, which decides the type of container in which to wrap the result
- Returns
the value, if there is one
Insert the given key-value pair into the cache, with an optional Time To Live.
Insert the given key-value pair into the cache, with an optional Time To Live.
Depending on the cache implementation, this may be done synchronously or asynchronously, so it returns a Future.
- Type Params
- F
The type of container in which the result will be wrapped. This is decided by the mode.
- V
The type of the corresponding value
- Value Params
- cache
The cache
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- keyParts
Data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.
- mode
The operation mode, which decides the type of container in which to wrap the result
- ttl
Time To Live (optional, if not specified then the entry will be cached indefinitely)
- value
the value to be cached
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.
Depending on the cache implementation, this may be done synchronously or asynchronously, so it returns a Future.
- Type Params
- F
The type of container in which the result will be wrapped. This is decided by the mode.
- V
The type of the value to be removed
- Value Params
- cache
The cache
- keyParts
Data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.
- mode
The operation mode, which decides the type of container in which to wrap the result