Class OLocalRecordCache
java.lang.Object
com.orientechnologies.orient.core.cache.OLocalRecordCache
Local cache. it's one to one with record database instances. It is needed to avoid cases when
several instances of the same record will be loaded by user from the same database.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Stringprotected Stringprotected ORecordCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidvoiddeleteRecord(ORID rid) Removes record with specified identifier from both primary and secondary cachesfindRecord(ORID rid) Looks up for record in cache by it's identifier.voidfreeCluster(int cid) Remove all records belonging to specified clusterfreeRecord(ORID rid) Remove record with specified identifierintgetSize()Total number of cached entriesvoidInvalidates the cache emptying all the records.booleanTell whether cache is enabledvoidsetEnable(boolean enable) Switch cache state between enabled and disabledvoidshutdown()voidtoString()voidupdateRecord(ORecord record) Pushes record to cache.
-
Field Details
-
underlying
-
profilerPrefix
-
profilerMetadataPrefix
-
excludedCluster
protected int excludedCluster
-
-
Constructor Details
-
OLocalRecordCache
public OLocalRecordCache()
-
-
Method Details
-
startup
-
updateRecord
Pushes record to cache. Identifier of record used as access key- Parameters:
record- record that should be cached
-
findRecord
Looks up for record in cache by it's identifier. Optionally look up in secondary cache and update primary with found record- Parameters:
rid- unique identifier of record- Returns:
- record stored in cache if any, otherwise -
null
-
deleteRecord
Removes record with specified identifier from both primary and secondary caches- Parameters:
rid- unique identifier of record
-
shutdown
public void shutdown() -
clear
public void clear() -
invalidate
public void invalidate()Invalidates the cache emptying all the records. -
toString
-
isEnabled
public boolean isEnabled()Tell whether cache is enabled- Returns:
trueif cache enabled at call time, otherwise -false
-
setEnable
public void setEnable(boolean enable) Switch cache state between enabled and disabled- Parameters:
enable- passtrueto enable, otherwise -false
-
freeRecord
Remove record with specified identifier- Parameters:
rid- unique identifier of record- Returns:
- record stored in cache if any, otherwise -
null
-
freeCluster
public void freeCluster(int cid) Remove all records belonging to specified cluster- Parameters:
cid- identifier of cluster
-
getSize
public int getSize()Total number of cached entries- Returns:
- non-negative integer
-
clearRecords
public void clearRecords()
-