1 Reply Latest reply on Jun 2, 2005 4:25 AM by belaban

    How to get a write-cache?

    mheirbau

      I am using jboss-cache and I've implemented my own cacheloader to load my data from disk. I do not need/use transactions and replication (yet).

      So basicly, when the node is still in the cache I get it from memory, and not from disk. When the cache is filling up, nodes get evicted. So basicly, I have now a read-cache.

      But when I put something in the cache, it is persisted immediatly through the cacheloader. Thus no write-cache.

      ==> How can I get/simulate the write-cache behavior? How are 'dirty' nodes written when shutting down the application/cache?

      Another, not related question: why does exist() behave differently than get with regard to the cache loader? If a node gets evicted, and I do a cache.exists(), it returns false, without checking the cacheloader. Why is that?

        • 1. Re: How to get a write-cache?
          belaban

           

          "mheirbau" wrote:
          I am using jboss-cache and I've implemented my own cacheloader to load my data from disk. I do not need/use transactions and replication (yet).

          So basicly, when the node is still in the cache I get it from memory, and not from disk. When the cache is filling up, nodes get evicted. So basicly, I have now a read-cache.

          But when I put something in the cache, it is persisted immediatly through the cacheloader. Thus no write-cache.



          What do you mean by write-cache ? Your CacheLoader could simply ignore the writes, and then behave as a read-cache. But then, it is up to the application to write the data back, e.g. to a DB.



          Another, not related question: why does exist() behave differently than get with regard to the cache loader? If a node gets evicted, and I do a cache.exists(), it returns false, without checking the cacheloader. Why is that?


          exists() doesn't acquire any locks, doesn't access the CacheLoader. Check the javadoc for exists()