8 Replies Latest reply on Mar 30, 2006 8:56 AM by adamw

    Shotoku cache

    adamw

      Hello,
      I've moved the cache (that was accesible through ForgeHelper up till now - NodeWatchers and ResourceWatchers), with some improvements added, to Shotoku. Here's a wiki page which describes how you use it: http://labs.jboss.com/wiki/CacheResWatchers. Also, I have changed the blog, feeds and contributors portlets to use the new cache. Please let me know what you think about it, will it be useable to you and eventually what would you like to see changed.

      --
      Cheers,
      Adam

        • 1. Re: Shotoku cache
          unibrew

          Hello

          I like those changes. Especially this ChangeType enum in 'void update(K key, T currentObject, Map<String, ChangeType?> changes)' is cool. Shame I didn't have this while doing Polls and DownloadCounters.
          I have two questions:
          - Is there a possibility to set the 'shotoku.service.interval', for a specified value in the cache, from the code?
          - Sometimes I would like to call 'save' on Node without noticing ResourceWatcher. Possible? :-)

          Cheers

          ------------------------
          Ryszard Kozmik
          JBoss Labs intern

          • 2. Re: Shotoku cache
            adamw

             

            "unibrew" wrote:
            I like those changes. Especially this ChangeType enum in 'void update(K key, T currentObject, Map<String, ChangeType?> changes)' is cool. Shame I didn't have this while doing Polls and DownloadCounters.


            Now you can use them and do Polls 2.0 ;-) .

            "unibrew" wrote:

            - Is there a possibility to set the 'shotoku.service.interval', for a specified value in the cache, from the code?


            No, it's a global property - right now. You think you would need individually-set intervals? It's doable :) .

            "unibrew" wrote:

            - Sometimes I would like to call 'save' on Node without noticing ResourceWatcher. Possible? :-)


            I don't think so. You (ContentManagers) never know where an update is coming from.

            --
            Cheers,
            Adam

            • 3. Re: Shotoku cache
              unibrew

               

              "adamw" wrote:
              "unibrew" wrote:
              I like those changes. Especially this ChangeType enum in 'void update(K key, T currentObject, Map<String, ChangeType?> changes)' is cool. Shame I didn't have this while doing Polls and DownloadCounters.

              Now you can use them and do Polls 2.0 ;-) .

              Yeah, right.... ;-)

              "adamw" wrote:

              "unibrew" wrote:

              - Is there a possibility to set the 'shotoku.service.interval', for a specified value in the cache, from the code?

              No, it's a global property - right now. You think you would need individually-set intervals? It's doable :) .


              Now probably there aren't any projects which could use such a feature. However, I'm thinking that e.g I would like to do some big processing once a day not so often as it is set in 'shotoku.service.interval' global property. I don't know how Kosmos is done and when it create those tons of stats images but it could use this feature.

              "adamw" wrote:

              "unibrew" wrote:

              - Sometimes I would like to call 'save' on Node without noticing ResourceWatcher. Possible? :-)

              I don't think so. You (ContentManagers) never know where an update is coming from.

              Hmmm ... lack of this feature is not a big problem but might be useful. I thought that special version of 'save' method could look like this (just a draft):
              save (....) {
              deleteWatchedPath(String key, String path);
              save (.......);
              addWatchedPath(String key, String path);
              }
              Of course, it can be done from my own code but why not in shotoku :-) .

              I thought about another feature of ShotokuResourceWatcher. What do you think about three separate methods updateDeleted, updateChanged, updateAdde invoked with parameters (String key, String currentObject, Set paths) containing only 'paths' with the same ChangeType.ADDED,DELETED or MODIFIED status. Those 'update****' methods would be invoked by the default implementation of 'update' method which we normaly override or from your 'public void update(K key, T currentObject)' or whatever, not my problem ;-) . Those methods would be really cool.

              Cheers
              ------------------------
              Ryszard Kozmik
              JBoss Labs intern


              • 4. Re: Shotoku cache
                adamw

                 

                "unibrew" wrote:

                "adamw" wrote:

                "unibrew" wrote:

                - Is there a possibility to set the 'shotoku.service.interval', for a specified value in the cache, from the code?

                No, it's a global property - right now. You think you would need individually-set intervals? It's doable :) .


                Now probably there aren't any projects which could use such a feature. However, I'm thinking that e.g I would like to do some big processing once a day not so often as it is set in 'shotoku.service.interval' global property. I don't know how Kosmos is done and when it create those tons of stats images but it could use this feature.


                http://jira.jboss.com/jira/browse/JBSHOTOKU-75 :).

                "unibrew" wrote:

                "adamw" wrote:

                "unibrew" wrote:

                - Sometimes I would like to call 'save' on Node without noticing ResourceWatcher. Possible? :-)

                I don't think so. You (ContentManagers) never know where an update is coming from.

                Hmmm ... lack of this feature is not a big problem but might be useful. I thought that special version of 'save' method could look like this (just a draft):
                save (....) {
                deleteWatchedPath(String key, String path);
                save (.......);
                addWatchedPath(String key, String path);
                }
                Of course, it can be done from my own code but why not in shotoku :-) .


                But this would require all of the content managers implementations to be very tightly bound with all ShotokuCacheItems - which is almost impossible. And I don't think of any use cases.

                "unibrew" wrote:

                I thought about another feature of ShotokuResourceWatcher. What do you think about three separate methods updateDeleted, updateChanged, updateAdde invoked with parameters (String key, String currentObject, Set<String> paths) containing only 'paths' with the same ChangeType.ADDED,DELETED or MODIFIED status. Those 'update****' methods would be invoked by the default implementation of 'update' method which we normaly override or from your 'public void update(K key, T currentObject)' or whatever, not my problem ;-) . Those methods would be really cool.


                Ah yes, I wanted to do this but forgot. Thanks for reminding :).

                --
                Cheers,
                Adam


                • 5. Re: Shotoku cache
                  unibrew

                   

                  "adamw" wrote:

                  http://jira.jboss.com/jira/browse/JBSHOTOKU-75 :).

                  You have my vote on it :-).

                  "adamw" wrote:

                  But this would require all of the content managers implementations to be very tightly bound with all ShotokuCacheItems - which is almost impossible. And I don't think of any use cases.

                  Yeah, you are rigth. This could mess up shotoku.

                  "adamw" wrote:

                  Ah yes, I wanted to do this but forgot. Thanks for reminding :).

                  Wise guy. I thought about this first ;-b

                  • 6. Re: Shotoku cache
                    adamw

                    Hello,

                    I've added the possibility to set intervals for cache items - with an annotation property "interval" or through the constructor.

                    --
                    Adam

                    • 7. Re: Shotoku cache
                      unibrew

                      Hi

                      Cool to have this feature :D
                      I consider using intervals in DownloadCounters and Polls, so that they would save their state in cms only once a day.

                      Cheers,
                      Rysiek


                      • 8. Re: Shotoku cache
                        adamw

                        Once a day may be to rare, because you never know when a server may be turned off and one day of data lost :). But once an hour, or once every 10 minutes, why not.

                        --
                        Cheers,
                        Adam