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

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • Component/s: Cache
    • Labels:
      None
    • Similar issues:

      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

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

              Dates

              Created:
              Updated: