public class DirectWriteMapDbCacheManyStore extends DirectWriteMapDbStore
DirectWriteMapDbStore
that uses an internal cache to store persisted Object
s that are part
of multi-valued EReference
s to speed-up their access.
Using a cache avoids multiple List
deserialization to retrieve the same element, which can be an important
bottleneck in terms of execution time and memory consumption if the underlying model contains very large Collection
s.
This store can be used as a base store that can be complemented by plugging decorator stores on top of it (see AbstractPersistentStoreDecorator
subclasses) to provide additional features such as caching or logging.
DEFAULT_CACHE_SIZE, persistentObjectsCache
backend
NO_INDEX
Constructor and Description |
---|
DirectWriteMapDbCacheManyStore(Resource.Internal resource,
MapDbPersistenceBackend backend)
Constructs a new
DirectWriteMapDbCacheManyStore between the given resource and the
backend . |
Modifier and Type | Method and Description |
---|---|
protected void |
addReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Adds the
value at the index in the content of the reference of the object . |
protected Object |
getFromMap(PersistentEObject object,
EStructuralFeature feature)
Returns the value associated to (
object , feature ) in the underlying database. |
addAttribute, clear, contains, eObject, getAttribute, getContainer, getContainingFeature, getFromMap, getReference, indexOf, isSet, lastIndexOf, removeAttribute, removeReference, setAttribute, setReference, size, unset, updateContainment, updateInstanceOf
add, clearAttribute, clearReference, containsAttribute, containsReference, create, get, hashCode, indexOfAttribute, indexOfReference, isEmpty, isSetAttribute, isSetReference, lastIndexOfAttribute, lastIndexOfReference, move, parseProperty, remove, resource, save, serializeToProperty, set, toArray, toArray, unsetAttribute, unsetReference
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllInstances
public DirectWriteMapDbCacheManyStore(Resource.Internal resource, MapDbPersistenceBackend backend)
DirectWriteMapDbCacheManyStore
between the given resource
and the
backend
.resource
- the resource to persist and accessbackend
- the persistence back-end used to store the modelprotected void addReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
AbstractDirectWriteStore
value
at the index
in the content of the reference
of the object
.addReference
in class DirectWriteMapDbStore
object
- the objectreference
- a many-valued reference of the object
index
- an index within the contentvalue
- the value to addAbstractDirectWriteStore.add(InternalEObject, EStructuralFeature, int, Object)
protected Object getFromMap(PersistentEObject object, EStructuralFeature feature)
DirectWriteMapDbStore
object
, feature
) in the underlying database.
This method behaves like: getFromMap(FeatureKey.from(object, feature)
.
getFromMap
in class DirectWriteMapDbStore
object
- the PersistentEObject
to look forfeature
- the EStructuralFeature
of object
to look forObject
stored in the database if it exists, null
otherwise. The returned Object
can be a single element or a Collection
.DirectWriteMapDbStore.getFromMap(FeatureKey)
Copyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.