\r\n

51Degrees Pipeline Java  4.4

51Degrees Pipeline for Java

fiftyone.caching.LruLoadingCache< K, V > Class Template Reference

Detailed Description

Uses the LruCacheBase to implement the LoadingCache interface.

Parameters
<K> - the type of key
<V> - the type of value

Inheritance diagram for fiftyone.caching.LruLoadingCache< K, V >:

[legend]

Collaboration diagram for fiftyone.caching.LruLoadingCache< K, V >:

[legend]

Classes

class  Builder
Implementation of CacheBuilder for LruLoadingCache caches. More...

Public Member Functions

 LruLoadingCache (int cacheSize, ValueLoader< K, V > loader)
Constructs a new instance of the cache. More...
void  setCacheLoader (ValueLoader< K, V > loader)
Set the loader used to fetch items not in the cache. More...
V  get (K key)
Retrieves the value for key requested. More...
V  get (K key, ValueLoader< K, V > loader) throws IOException
Retrieves the value for key requested. More...

Public Member Functions inherited from fiftyone.caching.LruCacheBase< K, V >

long  getCacheSize ()
The number of items the cache lists should have capacity for. More...
long  getCacheMisses ()
long  getCacheRequests ()
double  getPercentageMisses ()
V  get (K key)
Retrieves the value for key requested. More...
void  resetCache ()
Resets the 'stats' for the cache.
void  close ()

Constructor & Destructor Documentation

◆ LruLoadingCache()

fiftyone.caching.LruLoadingCache< K, V >.LruLoadingCache ( int   cacheSize,
ValueLoader< K, V >   loader  
)

Constructs a new instance of the cache.

Parameters
cacheSize - the number of items to store in the cache
loader - the loader used to fetch items not already in the cache

Member Function Documentation

◆ get() [1/2]

V fiftyone.caching.LruLoadingCache< K, V >.get ( K   key )

Retrieves the value for key requested.

If the key does not exist in the cache then the Fetch method of the cache's loader is used to retrieve the value.

Parameters
key - of the item required.
Returns
an instance of the value associated with the key
Exceptions
IllegalStateException - if there was a problem accessing data file

Implements fiftyone.caching.Cache< K, V >.

◆ get() [2/2]

V fiftyone.caching.LruLoadingCache< K, V >.get ( K   key,
ValueLoader< K, V >   loader  
) throws IOException

Retrieves the value for key requested.

If the key does not exist in the cache then the Fetch method is used to retrieve the value from another loader.

Parameters
key - of the item required
loader - to fetch the items from
Returns
an instance of the value associated with the key
Exceptions
java.io.IOException - if there was a problem accessing data file

Implements fiftyone.caching.LoadingCache< K, V >.

◆ setCacheLoader()

void fiftyone.caching.LruLoadingCache< K, V >.setCacheLoader ( ValueLoader< K, V >   loader )

Set the loader used to fetch items not in the cache.

Parameters
loader - the loader to use
On This Page