Q - type of search requestpublic class LRUCache<Q extends SearchRequest> extends Object implements Cache<Q>
LinkedHashMap.| Modifier and Type | Class and Description | 
|---|---|
| private class  | LRUCache.ItemContainer for data related to cached ldap results. | 
| Modifier and Type | Field and Description | 
|---|---|
| private Map<Q,LRUCache.Item> | cacheMap to cache search results. | 
| private ScheduledExecutorService | executorExecutor for performing eviction. | 
| private static int | INITIAL_CAPACITYInitial capacity of the hash map. | 
| private static float | LOAD_FACTORLoad factor of the hash map. | 
| Constructor and Description | 
|---|
| LRUCache(int size,
        Duration timeToLive,
        Duration interval)Creates a new LRU cache. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clear()Removes all data from this cache. | 
| void | close()Frees any resources associated with this cache. | 
| SearchResult | get(Q request)Returns the ldap result for the supplied request. | 
| void | put(Q request,
   SearchResult result)Stores the ldap result for the supplied request. | 
| int | size()Returns the number of items in this cache. | 
private static final int INITIAL_CAPACITY
private static final float LOAD_FACTOR
private Map<Q extends SearchRequest,LRUCache.Item> cache
private final ScheduledExecutorService executor
public void clear()
public SearchResult get(Q request)
Cacheget in interface Cache<Q extends SearchRequest>request - to find ldap result withpublic void put(Q request, SearchResult result)
Cacheput in interface Cache<Q extends SearchRequest>request - used to find ldap resultresult - found with requestpublic int size()
public void close()
Copyright © 2003-2019 Virginia Tech. All Rights Reserved.