Q
- type of search requestpublic class LRUCache<Q extends SearchRequest> extends Object implements Cache<Q>
LinkedHashMap
.Constructor and Description |
---|
LRUCache(int size,
long timeToLive,
long 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.
|
public LRUCache(int size, long timeToLive, long interval)
size
- number of results to cachetimeToLive
- in seconds that results should stay in the cacheinterval
- in seconds to enforce timeToLivepublic void clear()
public SearchResult get(Q request)
Cache
get
in interface Cache<Q extends SearchRequest>
request
- to find ldap result withpublic void put(Q request, SearchResult result)
Cache
put
in interface Cache<Q extends SearchRequest>
request
- used to find ldap resultresult
- found with requestpublic int size()
public void close()
Copyright © 2022. All rights reserved.