Configuration

Parameters

The standard configuration is - LRUCachingMapConfiguration implemented in DefaultLRUCachingMapConfiguration.

Name Type (DefaultLRUCachingMapConfiguration) Description
ExpireTime Long(ms) OR TimeSpan The number of milliseconds which the key lives in the cache and it will behave like a "normal" cache with fix time.
Has to be greather than zero.

ExtendTime Long(ms) OR TimeSpan The number of milliseconds which the key expireTime is extended which each "get" of the "key".
If less than one, then no extend of experation time and it will behave like a "normal" cache with fix time.

MaxExtendCount Integer The maximum number of times a "key" "expireTime" can be extented.
If less than one than "no limit" to the extend count.

MaxSize Integer The maximum number of keys in the cache.
Has to greather than zero.

CleanupIntervalTime Long(ms) OR TimeSpan The number of milliseconds between the cache is cleanup up, if greather than 0 the Internal thread is used (CleanupTimerRunnable),
otherwise you must handle the cleanup your self.

PersistedValuesInMemory Integer This configuration will only work for LRUCachingMaps which persists its values.
It tells if the values should be is stored in memory as well as getting persisted, this is a fast way to get the Value(V) instead of having to load it from persisted storage.
If false, than none will be stored in memory.
This will increase the speed you are getting the values from persisted implementations, but it will increase the memory footprint.
So when the LRUCachingMap is get a Value(V) by the Key(K) it will first ask if the value is in memory otherwise retrive it from persisted storage and put it in memory.
This is relevant if its after a restore.


Statics

Static methods in DefaultLRUCachingMapConfiguration which returns a new instance:

Name DEFAULT ONE_WEEK ONE_DAY ONE_HOUR TEN_MINUTES ONE_MINUTE
ExpireTime 12 hours 7 day 1 day 1 hour 10 minutes 1 minute
ExtendTime 1 hour 6 hours 1 hour 5 minutes 1 minute 0
MaxExtendCount 5 5 5 5 5 0
MaxSize 10000 10000 10000 10000 5000 1000
CleanupIntervalTime 15 minutes 1 hour 15 minutes 5 minutes 2 minutes 1 minute
PersistedValuesInMemory true false false true true true

Considerations

  • Think about what you set these values to, to poorly and your cache keeps growing, or you cache do not solves its purpose, and keys is remove to soon.
  • Have the context of use in mind, what do you need and how quickly. Getting the value from cache - versus - getting from scratch.
  • ExpireTime must not to high, it will use to much memory.
  • ExtendTime*ExtendCount must not to high, or keys will never expire.
  • CleanupIntervalTime, must not to low or the thread will use to much CPU.
  • CleanupIntervalTime, must not to high or you will have a lot of unnessecary keys in the cache.
  • MaxSize, must also have a carefull consideration.