As I understand your scenario is not primary use case for JBossCache. People from
Hibernate brought up this issue some time ago and as the result the method
putForExternalRead was added:
/**
| * Under special operating behavior, associates the value with the specified key
for a node identified by the Fqn passed in.
| * <ul>
| * <li> Only goes through if the node specified does not exist; no-op
otherwise.</i>
| * <li> Force asynchronous mode for replication to prevent any
blocking.</li>
| * <li> invalidation does not take place. </li>
| * <li> 0ms lock timeout to prevent any blocking here either. If the lock is
not acquired, this method is a no-op, and swallows the timeout exception.</li>
| * <li> Ongoing transactions are suspended before this call, so failures here
will not affect any ongoing transactions.</li>
| * <li> Errors and exceptions are 'silent' - logged at a much lower
level than normal, and this method does not throw exceptions</li>
| * </ul>
| * This method is for caching data that has an external representation in storage,
where, concurrent modification and
| * transactions are not a consideration, and failure to put the data in the cache
should be treated as a 'suboptimal outcome'
| * rather than a 'failing outcome'.
| * <p/>
| * An example of when this method is useful is when data is read from, for example,
a legacy datastore, and is cached before
| * returning the data to the caller. Subsequent calls would prefer to get the data
from the cache and if the data doesn't exist
| * in the cache, fetch again from the legacy datastore.
| * <p/>
| * See <a
href="http://jira.jboss.com/jira/browse/JBCACHE-848">JBCACHE...
for details around this feature.
| * <p/>
| *
| * @param fqn <b><i>absolute</i></b> {@link Fqn} to the
{@link Node} to be accessed.
| * @param key key with which the specified value is to be associated.
| * @param value value to be associated with the specified key.
| * @throws IllegalStateException if {@link #getCacheStatus()} would not return
{@link org.jboss.cache.CacheStatus#STARTED}.
| */
| void putForExternalRead(Fqn fqn, K key, V value);
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268556#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...