T - type of entry.public class ExpirableObjectStore<T extends Serializable> extends Object implements org.mule.runtime.api.store.ObjectStore<T>
ObjectStore, ensuring that when any message is answered, the requested entry has not yet expired.
NOTE (I): Mule API already provides an ExpirableObjectStore. This implementation differs
from that in that each entry can be expired at a different pace by delegating the expiration configuration in the
ExpirableObjectFactory. NOTE (II): This implementation is NOT thread safe.
| Constructor and Description |
|---|
ExpirableObjectStore(org.mule.runtime.api.store.ObjectStore<Expirable<T>> innerOS,
ExpirableObjectFactory<T> expirableObjectFactory) |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
allKeys() |
void |
clear() |
void |
close() |
boolean |
contains(String key) |
protected org.mule.runtime.api.store.ObjectDoesNotExistException |
expiredEntryException(Serializable key) |
boolean |
isPersistent() |
void |
open() |
T |
remove(String key) |
T |
retrieve(String key) |
Map<String,T> |
retrieveAll() |
void |
store(String key,
T value) |
public ExpirableObjectStore(org.mule.runtime.api.store.ObjectStore<Expirable<T>> innerOS, ExpirableObjectFactory<T> expirableObjectFactory)
public boolean contains(String key) throws org.mule.runtime.api.store.ObjectStoreException
If entry exists but has expired, this method will return false.
contains in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic void store(String key, T value) throws org.mule.runtime.api.store.ObjectStoreException
Storing multiple times values for the same key will result in overwriting the previous values.
store in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic T retrieve(String key) throws org.mule.runtime.api.store.ObjectStoreException
If the entry exists but has expired, it will be removed from is internal ObjectStore and an
ObjectDoesNotExistException will be thrown.
retrieve in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic T remove(String key) throws org.mule.runtime.api.store.ObjectStoreException
Entry will be always removed, but if it has expired, an ObjectDoesNotExistException will be thrown.
remove in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic boolean isPersistent()
isPersistent in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>public void clear()
throws org.mule.runtime.api.store.ObjectStoreException
clear in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic void open()
throws org.mule.runtime.api.store.ObjectStoreException
open in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic void close()
throws org.mule.runtime.api.store.ObjectStoreException
close in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic List<String> allKeys() throws org.mule.runtime.api.store.ObjectStoreException
allKeys in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionpublic Map<String,T> retrieveAll() throws org.mule.runtime.api.store.ObjectStoreException
As every entry must be processed, this ObjectStore will clean up expired entries before returning them. Beware that
an entry can expire between when is processed and this method returns.
retrieveAll in interface org.mule.runtime.api.store.ObjectStore<T extends Serializable>org.mule.runtime.api.store.ObjectStoreExceptionprotected org.mule.runtime.api.store.ObjectDoesNotExistException expiredEntryException(Serializable key)
Copyright © 2014–2023 MuleSoft, Inc.. All rights reserved.