Package org.teiid.common.buffer
Interface Cache<T>
-
- All Superinterfaces:
StorageManager
- All Known Implementing Classes:
BufferFrontedFileStoreCache
,MemoryStorageManager
public interface Cache<T> extends StorageManager
Represents the storage strategy for theBufferManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(CacheEntry entry, Serializer<?> s)
Adds an entry to the cache.boolean
addToCacheGroup(Long gid, Long oid)
Must be called prior to adding an entryvoid
createCacheGroup(Long gid)
Must be called prior to adding any group entriesCacheEntry
get(T lock, Long oid, WeakReference<? extends Serializer<?>> ref)
Get method, must be called using the object obtained in the lockForLoad methodint
getCacheGroupCount()
long
getMemoryBufferSpace()
T
lockForLoad(Long oid, Serializer<?> serializer)
Lock the object for load and return an identifier/lock that can be used to retrieve the object.Integer
remove(Long gid, Long id)
Remove an entry from the cache, return the sizeEstimate if the entry existedCollection<Long>
removeCacheGroup(Long gid)
Remove an entire cache group TODO: this should use a callback on the buffermangaer to remove memory entries without materializing all group keysvoid
shutdown()
void
unlockForLoad(T lock)
Must be called after lockForLoad-
Methods inherited from interface org.teiid.common.buffer.StorageManager
createFileStore, getMaxStorageSpace, initialize
-
-
-
-
Method Detail
-
createCacheGroup
void createCacheGroup(Long gid)
Must be called prior to adding any group entries- Parameters:
gid
-
-
removeCacheGroup
Collection<Long> removeCacheGroup(Long gid)
Remove an entire cache group TODO: this should use a callback on the buffermangaer to remove memory entries without materializing all group keys- Parameters:
gid
-- Returns:
-
addToCacheGroup
boolean addToCacheGroup(Long gid, Long oid)
Must be called prior to adding an entry- Parameters:
gid
-oid
-- Returns:
- if the add was successful
-
lockForLoad
T lockForLoad(Long oid, Serializer<?> serializer)
Lock the object for load and return an identifier/lock that can be used to retrieve the object.- Parameters:
oid
-serializer
-- Returns:
- the identifier, may be null
-
unlockForLoad
void unlockForLoad(T lock)
Must be called after lockForLoad
-
get
CacheEntry get(T lock, Long oid, WeakReference<? extends Serializer<?>> ref) throws TeiidComponentException
Get method, must be called using the object obtained in the lockForLoad method- Returns:
- Throws:
TeiidComponentException
-
add
boolean add(CacheEntry entry, Serializer<?> s) throws Exception
Adds an entry to the cache.- Parameters:
entry
-s
-- Throws:
Exception
-
remove
Integer remove(Long gid, Long id)
Remove an entry from the cache, return the sizeEstimate if the entry existed- Parameters:
gid
-id
-
-
shutdown
void shutdown()
-
getMemoryBufferSpace
long getMemoryBufferSpace()
-
getCacheGroupCount
int getCacheGroupCount()
-
-