/** * Retrieve the Pojo from the cache. Return null if object does not exist in the cache. * * @param fqn Instance that associates with this node. * @return Current POJO value. Null if does not exist. * @throws CacheException */ Object getObject(Fqn fqn) throws CacheException;
This call will return the current object content located under fqn. This method call is useful when you don't have the exact POJO reference. For example, when you fail over to the replicated node, you want to get the object reference from the replicated cache instance. In that case, PojoCache will create a new Java object if it does not exist and then add the cache interceptor such that every future access will be in sync with the underlying cache store.
/** * Query all managed pojo objects under the fqn recursively. Note that this will not return *the sub-object POJOs, e.g., if Person has a sub-object of Address, it won't return Address *pojo. Note also that this operation is not thread-safe now. In addition, it assumes *that once a pojo is found with a fqn, no more pojo is stored under the children of the fqn. *That is, we don't mixed the fqn with different POJOs. * @param fqn The starting place to find all POJOs. * @return Map of all POJOs found with (fqn, pojo) pair. Return size of 0, if not found. * @throws CacheException */ public Map findObjects(Fqn fqn) throws CacheException;
This call will return all the managed POJOs under cache with a base Fqn name. It is recursive, meaning that it will traverse all the sub-trees to find the POJOs under that base. For example, if you specify the fqn to be root, e.g., "/" , then it will return all the managed POJOs under the cache.
Note also that this operation is currently not thread-safe. In addition, it assumes that once a pojo is found with a fqn, no more pojo is stored under the children of the fqn. That is, we don't mixed the fqn with different POJOs.