org.apache.directmemory.cache
Class CacheServiceImpl<K,V>
java.lang.Object
org.apache.directmemory.cache.CacheServiceImpl<K,V>
- All Implemented Interfaces:
- CacheService<K,V>
public class CacheServiceImpl<K,V>
- extends Object
- implements CacheService<K,V>
|
Method Summary |
|
allocate(K key,
Class<T> type,
int size)
|
void |
clear()
|
void |
collectAll()
|
void |
collectExpired()
|
void |
collectLFU()
|
void |
dump()
|
void |
dump(MemoryManagerService<V> mms)
|
long |
entries()
|
void |
free(K key)
|
void |
free(Pointer<V> pointer)
|
ConcurrentMap<K,Pointer<V>> |
getMap()
|
MemoryManagerService<V> |
getMemoryManager()
|
Pointer<V> |
getPointer(K key)
|
Serializer |
getSerializer()
|
Pointer<V> |
put(K key,
V value)
|
Pointer<V> |
put(K key,
V value,
int expiresIn)
|
Pointer<V> |
putByteArray(K key,
byte[] payload)
|
Pointer<V> |
putByteArray(K key,
byte[] payload,
int expiresIn)
|
V |
retrieve(K key)
|
byte[] |
retrieveByteArray(K key)
|
void |
scheduleDisposalEvery(long l)
|
void |
setMap(ConcurrentMap<K,Pointer<V>> map)
|
void |
setMemoryManager(MemoryManagerService<V> memoryManager)
|
void |
setSerializer(Serializer serializer)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CacheServiceImpl
public CacheServiceImpl(ConcurrentMap<K,Pointer<V>> map,
MemoryManagerService<V> memoryManager,
Serializer serializer)
- Constructor
scheduleDisposalEvery
public void scheduleDisposalEvery(long l)
- Specified by:
scheduleDisposalEvery in interface CacheService<K,V>
putByteArray
public Pointer<V> putByteArray(K key,
byte[] payload)
- Specified by:
putByteArray in interface CacheService<K,V>
putByteArray
public Pointer<V> putByteArray(K key,
byte[] payload,
int expiresIn)
- Specified by:
putByteArray in interface CacheService<K,V>
expiresIn - in ms
- Returns:
put
public Pointer<V> put(K key,
V value)
- Specified by:
put in interface CacheService<K,V>
put
public Pointer<V> put(K key,
V value,
int expiresIn)
- Specified by:
put in interface CacheService<K,V>
expiresIn - in ms
- Returns:
retrieveByteArray
public byte[] retrieveByteArray(K key)
- Specified by:
retrieveByteArray in interface CacheService<K,V>
retrieve
public V retrieve(K key)
- Specified by:
retrieve in interface CacheService<K,V>
getPointer
public Pointer<V> getPointer(K key)
- Specified by:
getPointer in interface CacheService<K,V>
free
public void free(K key)
- Specified by:
free in interface CacheService<K,V>
free
public void free(Pointer<V> pointer)
- Specified by:
free in interface CacheService<K,V>
collectExpired
public void collectExpired()
- Specified by:
collectExpired in interface CacheService<K,V>
collectLFU
public void collectLFU()
- Specified by:
collectLFU in interface CacheService<K,V>
collectAll
public void collectAll()
- Specified by:
collectAll in interface CacheService<K,V>
clear
public void clear()
- Specified by:
clear in interface CacheService<K,V>
entries
public long entries()
- Specified by:
entries in interface CacheService<K,V>
dump
public void dump(MemoryManagerService<V> mms)
dump
public void dump()
- Specified by:
dump in interface CacheService<K,V>
getMap
public ConcurrentMap<K,Pointer<V>> getMap()
- Specified by:
getMap in interface CacheService<K,V>
setMap
public void setMap(ConcurrentMap<K,Pointer<V>> map)
- Specified by:
setMap in interface CacheService<K,V>
getSerializer
public Serializer getSerializer()
- Specified by:
getSerializer in interface CacheService<K,V>
setSerializer
public void setSerializer(Serializer serializer)
- Specified by:
setSerializer in interface CacheService<K,V>
getMemoryManager
public MemoryManagerService<V> getMemoryManager()
- Specified by:
getMemoryManager in interface CacheService<K,V>
setMemoryManager
public void setMemoryManager(MemoryManagerService<V> memoryManager)
- Specified by:
setMemoryManager in interface CacheService<K,V>
allocate
public <T extends V> Pointer<V> allocate(K key,
Class<T> type,
int size)
- Specified by:
allocate in interface CacheService<K,V>
Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.