5 Replies Latest reply on Jul 22, 2008 5:49 AM by manik

    File system cache size limitation

    eug-su

      I'm new to JBoss Cache.

      How can i limit file system cache size? (In bytes or in nodes).
      I can't find a configuration property for it.

      What is the easiest way to do it?


      Now i install cache listener and on NodeEvicted event check the location directory size.

      How to do it right?

      Thanks.

        • 1. Re: File system cache size limitation
          manik

          Use an eviction policy and specify maxNodes.

          • 2. Re: File system cache size limitation
            eug-su

            Eviction policy as i got defines which nodes should be removed from memory to secondary datastore (file, database, ...).

            maxNodes is a max amount of nodes in memory, but not in secondary cache (file system, db).

            If i'm not right and eviction policy can control file system cache size, please, give a more concrete answer.

            Sorry for my bad english.

            Thanks for help.

            • 3. Re: File system cache size limitation
              genman

              That's not supported. But you could have a secondary process that scanned and deleted directories that were over a certain age. Though, it'd be risky I think.

              I think the JDBC cache loader and others cache loaders could do a better job tracking creation/modification time to allow a secondary process to prune data.

              • 4. Re: File system cache size limitation
                genman

                One way to do this in a safe way is to create your own keys that indicate the modification and/or creation time of that node. Iterate over all the JBoss Cache nodes and purge anything too old. Unfortunately, you do end up having to visit (and load) all the data in the cache.

                • 5. Re: File system cache size limitation
                  manik

                  Yes, there is no such feature to limit the size of persisted state on disk. Sensible contributions welcome. :-)