Documentation of 'org.mapdb.StoreCached' Java class
StoreCached
org.mapdb

Class StoreCached

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Engine
    Direct Known Subclasses:
    StoreWAL


    public class StoreCached
    extends StoreDirect
    Extends StoreDirect with Write Cache
    • Constructor Detail

      • StoreCached

        public StoreCached(java.lang.String fileName,
                           Volume.VolumeFactory volumeFactory,
                           Store.Cache cache,
                           int lockScale,
                           int lockingStrategy,
                           boolean checksum,
                           boolean compress,
                           byte[] password,
                           boolean readonly,
                           boolean snapshotEnable,
                           boolean fileLockDisable,
                           DataIO.HeartbeatFileLock fileLockHeartbeat,
                           java.util.concurrent.ScheduledExecutorService executor,
                           long startSize,
                           long sizeIncrement,
                           boolean recidReuseDisable,
                           long executorScheduledRate,
                           int writeQueueSize)
      • StoreCached

        public StoreCached(java.lang.String fileName)
    • Method Detail

      • put

        public <A> long put(A value,
                            Serializer<A> serializer)
        Description copied from interface: Engine
        Insert new record.
        Specified by:
        put in interface Engine
        Overrides:
        put in class StoreDirect
        Parameters:
        value - records to be added
        serializer - used to convert record into/from binary form
        Returns:
        recid (record identifier) under which record is stored.
      • update

        public <A> void update(long recid,
                               A value,
                               Serializer<A> serializer)
        Description copied from interface: Engine

        Update existing record with new value.

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.

        Specified by:
        update in interface Engine
        Overrides:
        update in class Store
        Parameters:
        recid - (record identifier) under which record was persisted.
        value - new record value to be stored
        serializer - used to serialize record into binary form
      • compareAndSwap

        public <A> boolean compareAndSwap(long recid,
                                          A expectedOldValue,
                                          A newValue,
                                          Serializer<A> serializer)
        Description copied from interface: Engine

        Updates existing record in atomic (Compare And Swap) manner. Value is modified only if old value matches expected value. There are three ways to match values, MapDB may use any of them:

        1. Equality check oldValue==expectedOldValue when old value is found in instance cache
        2. Deserializing oldValue using serializer and checking oldValue.equals(expectedOldValue)
        3. Serializing expectedOldValue using serializer and comparing binary array with already serialized oldValue

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.

        Specified by:
        compareAndSwap in interface Engine
        Overrides:
        compareAndSwap in class Store
        Parameters:
        recid - (record identifier) under which record was persisted.
        expectedOldValue - old value to be compared with existing record
        newValue - to be written if values are matching
        serializer - used to serialize record into binary form
        Returns:
        true if values matched and newValue was written

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.