Class OLocalRecordCache

java.lang.Object
com.orientechnologies.orient.core.cache.OLocalRecordCache

public class OLocalRecordCache extends Object
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 Details

    • underlying

      protected ORecordCache underlying
    • profilerPrefix

      protected String profilerPrefix
    • profilerMetadataPrefix

      protected String profilerMetadataPrefix
    • excludedCluster

      protected int excludedCluster
  • Constructor Details

    • OLocalRecordCache

      public OLocalRecordCache()
  • Method Details

    • startup

      public void startup(ODatabaseSession db)
    • updateRecord

      public void updateRecord(ORecord record)
      Pushes record to cache. Identifier of record used as access key
      Parameters:
      record - record that should be cached
    • findRecord

      public ORecord findRecord(ORID rid)
      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

      public void deleteRecord(ORID rid)
      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

      public String toString()
      Overrides:
      toString in class Object
    • isEnabled

      public boolean isEnabled()
      Tell whether cache is enabled
      Returns:
      true if cache enabled at call time, otherwise - false
    • setEnable

      public void setEnable(boolean enable)
      Switch cache state between enabled and disabled
      Parameters:
      enable - pass true to enable, otherwise - false
    • freeRecord

      public ORecord freeRecord(ORID rid)
      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()