3 Replies Latest reply on Jan 5, 2010 7:41 AM by adamw

    How to use second level caching for *_AUD entities?

      Hello all

      I am using terracotta distributed 2nd level cache to scale my application.

      Is it possible to use 2nd level cache for *_AUD entities created by Envers?

      For conventional entities this is done by using @Cache annotation on class for field.

       

      Thanks.

        • 1. Re: How to use second level caching for *_AUD entities?
          adamw

          Hello,

           

          I don't think it's possible right now. There's only a 1st level cache.

          Although adding this feature shouldn't be very hard, you would just need to generate some additional metadata.

           

          One thing to look out for is to ensure that the _AUD entities are invalidated after some time, as they are never changed, so they would never get invalidated because of changes. So unless they would be invalidated after some time, they would stick in memory for a potentially very long time.

           

          Adam

          • 2. Re: How to use second level caching for *_AUD entities?
            hernanbolido

            It´s an interesting feature... but I can´t imagine how a 2nd level cache hit could separate the different revisions for the same entity.

            I´m thinking that the key for a cache is className + id, so different revisions can´t be separated... We need a key like className + id + revision, don´t we?

             

            Thanks. Hernán.

            • 3. Re: How to use second level caching for *_AUD entities?
              adamw

              The key of the _AUD entities consists of the original key plus the revision number, so there's no problem here.

               

              Adam