public class ItemInfoCacheImpl extends Object implements ItemInfoCache
ItemInfoCache
has a default size of 5000 items.
Item infos are put into the cache after they have been read from the RepositoryService
.
If the cache is full, the oldest item is discarded. Reading items removes them
from the cache.
The underlying idea here is, that ItemInfo
s which are supplied by the
RepositoryService
but not immediately needed are put into the
cache to avoid further round trips to RepositoryService
.
When they are needed later, they are read from the cache. There is no need to
keep them in this cache after that point since they are present in the
hierarchy from then on.ItemInfoCache.Entry<T extends ItemInfo>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_SIZE
Default size of the cache.
|
Constructor and Description |
---|
ItemInfoCacheImpl()
Create a new instance with the default cache size.
|
ItemInfoCacheImpl(int cacheSize)
Create a new instance with a given cache size.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Clear the cache and dispose all entries.
|
ItemInfoCache.Entry<NodeInfo> |
getNodeInfo(NodeId nodeId)
This implementation removes the item from the cache
if it is present.
|
ItemInfoCache.Entry<PropertyInfo> |
getPropertyInfo(PropertyId propertyId)
This implementation removes the item from the cache
if it is present.
|
void |
put(ItemInfo info,
long generation)
This implementation cached the item by its id and if the id
is uuid based but has no path, also by its path.
|
public static final int DEFAULT_CACHE_SIZE
public ItemInfoCacheImpl()
DEFAULT_CACHE_SIZE
public ItemInfoCacheImpl(int cacheSize)
cacheSize
- public ItemInfoCache.Entry<NodeInfo> getNodeInfo(NodeId nodeId)
nodeId
id uuid based, and no item is found by the nodeId
a second lookup is done by the path.getNodeInfo
in interface ItemInfoCache
nodeId
- id of the entry to lookup.Entry<NodeInfo>
instance or null
if not found.public ItemInfoCache.Entry<PropertyInfo> getPropertyInfo(PropertyId propertyId)
propertyId
id uuid based, and no item is found by the propertyId
a second lookup is done by the path.getPropertyInfo
in interface ItemInfoCache
propertyId
- id of the entry to lookup.Entry<PropertyInfo>
instance or
null
if not found.public void put(ItemInfo info, long generation)
put
in interface ItemInfoCache
public void dispose()
ItemInfoCache
dispose
in interface ItemInfoCache
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.