PersistentDataStoreBuilder
and will be made
package-private starting in version 5.0.@Deprecated public class CachingStoreWrapper extends java.lang.Object implements FeatureStore
FeatureStore
that delegates the basic
functionality to an instance of FeatureStoreCore
. It provides optional caching behavior and
other logic that would otherwise be repeated in every feature store implementation. This makes it
easier to create new database integrations by implementing only the database-specific logic.
Construct instances of this class with builder(FeatureStoreCore)
.
Modifier and Type | Class and Description |
---|---|
static class |
CachingStoreWrapper.Builder
Deprecated.
Builder for instances of
CachingStoreWrapper . |
Modifier | Constructor and Description |
---|---|
protected |
CachingStoreWrapper(FeatureStoreCore core,
FeatureStoreCacheConfig caching,
CacheMonitor cacheMonitor)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
<T extends VersionedData> |
all(VersionedDataKind<T> kind)
Deprecated.
Returns a
Map of all associated objects of a given kind. |
static CachingStoreWrapper.Builder |
builder(FeatureStoreCore core)
Deprecated.
Creates a new builder.
|
void |
close()
Deprecated.
|
<T extends VersionedData> |
delete(VersionedDataKind<T> kind,
java.lang.String key,
int version)
Deprecated.
Deletes the object associated with the specified key, if it exists and its version
is less than or equal to the specified version.
|
<T extends VersionedData> |
get(VersionedDataKind<T> kind,
java.lang.String key)
Deprecated.
Returns the object to which the specified key is mapped, or
null if the key is not associated or the associated object has
been deleted.
|
com.google.common.cache.CacheStats |
getCacheStats()
Deprecated.
Return the underlying Guava cache stats object.
|
FeatureStoreCore |
getCore()
Deprecated.
Return the underlying implementation object.
|
void |
init(java.util.Map<VersionedDataKind<?>,java.util.Map<java.lang.String,? extends VersionedData>> allData)
Deprecated.
Initializes (or re-initializes) the store with the specified set of objects.
|
boolean |
initialized()
Deprecated.
Returns true if this store has been initialized.
|
<T extends VersionedData> |
upsert(VersionedDataKind<T> kind,
T item)
Deprecated.
Update or insert the object associated with the specified key, if its version
is less than or equal to the version specified in the argument object.
|
protected CachingStoreWrapper(FeatureStoreCore core, FeatureStoreCacheConfig caching, CacheMonitor cacheMonitor)
public static CachingStoreWrapper.Builder builder(FeatureStoreCore core)
core
- the FeatureStoreCore
instancepublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public <T extends VersionedData> T get(VersionedDataKind<T> kind, java.lang.String key)
FeatureStore
get
in interface FeatureStore
T
- class of the object that will be returnedkind
- the kind of object to getkey
- the key whose associated object is to be returnedpublic <T extends VersionedData> java.util.Map<java.lang.String,T> all(VersionedDataKind<T> kind)
FeatureStore
Map
of all associated objects of a given kind.all
in interface FeatureStore
T
- class of the objects that will be returned in the mapkind
- the kind of objects to getpublic void init(java.util.Map<VersionedDataKind<?>,java.util.Map<java.lang.String,? extends VersionedData>> allData)
FeatureStore
If possible, the store should update the entire data set atomically. If that is not possible, it should iterate through the outer map and then the inner map in the order provided (the SDK will use a Map subclass that has a defined ordering), storing each item, and then delete any leftover items at the very end.
The store should not attempt to modify any of the Maps, and if it needs to retain the data in memory it should copy the Maps.
init
in interface FeatureStore
allData
- all objects to be storedpublic <T extends VersionedData> void delete(VersionedDataKind<T> kind, java.lang.String key, int version)
FeatureStore
delete
in interface FeatureStore
T
- class of the object to be deletedkind
- the kind of object to deletekey
- the key of the object to be deletedversion
- the version for the delete operationpublic <T extends VersionedData> void upsert(VersionedDataKind<T> kind, T item)
FeatureStore
upsert
in interface FeatureStore
T
- class of the object to be updatedkind
- the kind of object to updateitem
- the object to update or insertpublic boolean initialized()
FeatureStore
initialized
in interface FeatureStore
public com.google.common.cache.CacheStats getCacheStats()
public FeatureStoreCore getCore()