Package

scalacache

Permalink

package scalacache

Linear Supertypes
StrictLogging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. scalacache
  2. StrictLogging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. trait Cache extends AnyRef

    Permalink
  2. case class CacheConfig(keyPrefix: Option[String] = None, keySeparator: String = ":") extends Product with Serializable

    Permalink

    Configuration options for ScalaCache

    Configuration options for ScalaCache

    keyPrefix

    A global prefix that should be prepended to all cache keys. Useful for namespacing if you are sharing your cache with another application.

    keySeparator

    The value used to separate different parts of a cache key

  3. trait CacheKeyBuilder extends AnyRef

    Permalink
  4. case class Flags(readsEnabled: Boolean = true, writesEnabled: Boolean = true) extends Product with Serializable

    Permalink

    Configuration flags for conditionally altering the behaviour of ScalaCache.

    Configuration flags for conditionally altering the behaviour of ScalaCache.

    readsEnabled

    if false, cache GETs will be skipped (and will return None)

    writesEnabled

    if false, cache PUTs will be skipped

  5. sealed trait HashingAlgorithm extends AnyRef

    Permalink

    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

  6. trait LoggingSupport extends AnyRef

    Permalink

    Helper methods for logging

  7. case class ScalaCache(cache: Cache, cacheConfig: CacheConfig = CacheConfig(), keyBuilder: CacheKeyBuilder = DefaultCacheKeyBuilder, memoization: MemoizationConfig = MemoizationConfig()) extends Product with Serializable

    Permalink

    Container holding the cache itself, along with all necessary configuration.

    Container holding the cache itself, along with all necessary configuration.

    cache

    The cache itself

    memoization

    Configuration related to method memoization

Value Members

  1. object DefaultCacheKeyBuilder extends CacheKeyBuilder

    Permalink
  2. object Flags extends Serializable

    Permalink
  3. object MD5 extends HashingAlgorithm with Product with Serializable

    Permalink

    MD5 returns 32 character long hexadecimal hash strings

  4. object SHA1 extends HashingAlgorithm with Product with Serializable

    Permalink

    SHA1 returns 40 character long hexadecimal hash strings

  5. object SHA256 extends HashingAlgorithm with Product with Serializable

    Permalink

    SHA256 returns 64 character long hexadecimal hash strings

  6. object SHA512 extends HashingAlgorithm with Product with Serializable

    Permalink

    SHA512 returns 128 character long hexadecimal hash strings

  7. def caching[V](keyParts: Any*)(f: ⇒ V)(implicit scalaCache: ScalaCache, flags: Flags): V

    Permalink

    Wrap the given block with a caching decorator.

    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: Because no TTL is specified, the result will be stored in the cache indefinitely.

    V

    the type of the block's result

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

    f

    the block to run

    returns

    the result, either retrived from the cache or returned by the block

  8. def cachingWithTTL[V](keyParts: Any*)(ttl: Duration)(f: ⇒ V)(implicit scalaCache: ScalaCache, flags: Flags): V

    Permalink

    Wrap the given block with a caching decorator.

    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.

    The result will be stored in the cache until the given TTL expires.

    V

    the type of the block's result

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

    ttl

    Time To Live

    f

    the block to run

    returns

    the result, either retrived from the cache or returned by the block

  9. def get[V](keyParts: Any*)(implicit scalaCache: ScalaCache, flags: Flags): Future[Option[V]]

    Permalink

    Get the value corresponding to the given key from the cache.

    Get the value corresponding to the given key from the cache.

    Depending on the cache implementation, this may be done synchronously or asynchronously, so it returns a Future.

    V

    the type of the corresponding value

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

    returns

    the value, if there is one

  10. def getSync[V](keyParts: Any*)(implicit scalaCache: ScalaCache, flags: Flags): Option[V]

    Permalink

    Convenience method to get a value from the cache synchronously.

    Convenience method to get a value from the cache synchronously. Warning: may block indefinitely!

    V

    the type of the corresponding value

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

    returns

    the value, if there is one

  11. val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    StrictLogging
  12. package memoization

    Permalink

    Utilities for memoizing the results of method calls in a cache.

    Utilities for memoizing the results of method calls in a cache. The cache key is generated from the method arguments using a macro, so that you don't have to bother passing them manually.

  13. def put[V](keyParts: Any*)(value: V, ttl: Option[Duration] = None)(implicit scalaCache: ScalaCache, flags: Flags): Future[Unit]

    Permalink

    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.

    V

    the type of the corresponding value

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

    value

    the value to be cached

    ttl

    Time To Live (optional, if not specified then the entry will be cached indefinitely)

  14. def putWithKey[V](key: String, value: V, ttl: Option[Duration] = None)(implicit scalaCache: ScalaCache, flags: Flags): Future[Unit]

    Permalink
  15. def remove(keyParts: Any*)(implicit scalaCache: ScalaCache): Future[Unit]

    Permalink

    Remove the given key and its associated value from the cache, if it exists.

    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.

    keyParts

    data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.

  16. def removeAll()(implicit scalaCache: ScalaCache): Future[Unit]

    Permalink

    Delete the entire contents of the cache.

    Delete the entire contents of the cache. Use wisely!

Inherited from StrictLogging

Inherited from AnyRef

Inherited from Any

Ungrouped