Package com.db4o.io
Class CachingStorage
- java.lang.Object
-
- com.db4o.io.StorageDecorator
-
- com.db4o.io.CachingStorage
-
- All Implemented Interfaces:
Storage
public class CachingStorage extends StorageDecorator
Caching storage adapter to cache db4o database data in memory until the underlyingBin
is instructed to flush its data whenBin.sync()
is called.
You can override thenewCache()
method if you want to work with a different caching strategy.
-
-
Field Summary
-
Fields inherited from class com.db4o.io.StorageDecorator
_storage
-
-
Constructor Summary
Constructors Constructor Description CachingStorage(Storage storage)
default constructor to create a Caching storage with the default page count of 64 and the default page size of 1024.CachingStorage(Storage storage, int pageCount, int pageSize)
constructor to set up a CachingStorage with a configured page count and page size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Cache4<java.lang.Long,java.lang.Object>
newCache()
override this method if you want to work with a different caching strategy than the default LRU2Q cache.Bin
open(BinConfiguration config)
opens a Bin for the given URI.-
Methods inherited from class com.db4o.io.StorageDecorator
decorate, delete, exists, rename
-
-
-
-
Constructor Detail
-
CachingStorage
public CachingStorage(Storage storage)
default constructor to create a Caching storage with the default page count of 64 and the default page size of 1024.- Parameters:
storage
- theStorage
to be cached.
-
CachingStorage
public CachingStorage(Storage storage, int pageCount, int pageSize)
constructor to set up a CachingStorage with a configured page count and page size- Parameters:
storage
- theStorage
to be cached.pageCount
- the number of pages the cache should use.pageSize
- the size of the pages the cache should use.
-
-
Method Detail
-
open
public Bin open(BinConfiguration config) throws Db4oIOException
opens a Bin for the given URI.- Specified by:
open
in interfaceStorage
- Overrides:
open
in classStorageDecorator
- Throws:
Db4oIOException
-
newCache
protected Cache4<java.lang.Long,java.lang.Object> newCache()
override this method if you want to work with a different caching strategy than the default LRU2Q cache.
-
-