Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-1043

Add API to iterate over all cache entries in a cache

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 3.0
    • Cache
    • None

    Description

      Here's a use case:

      {{groovy}}
      def docInCache = new HashMap()
      def cache = xwiki.getXWiki().store.cache;
      def jcache = xwiki.getXWiki().getPrivateField(cache, "cache");
      def items = jcache.getRoot().getChildren();
      for (item in items) {
        for (child in item.getChildren()) {
          for (doc in child.getData().values()) {
            def key = (doc.language==null) ? "${doc.database}:${doc.fullName}" : "${doc.database}:${doc.fullName}:${doc.language}"
            docInCache.put(key, doc.version)
            // println "${key}: ${doc.version}"
          }
        }
       }
      ...
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: