We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31410
    • 66 Posts
    hello
    i have started working with XPDO everything is going well with this great ORB
    and in fact i was preparing extended documentation with code examples for XPDO
    but i struck when i want to retrieve the results from cache

    please help me how to retrieve the cached results
    i have enabled XPDO_OPT_CACHE_DB=>true
    the result set is stored in the cache directory

    i understand that we need to use fromcache() call but what is the $signature parameter
    i dint understand what value i have to give for this parameter

    anybody please give a brief tutorial about how to use cache in XPDO and i will add this in my ext doc so it wil be usefull for other users also

    thank you
    venu
    • Quote from: venu at May 21, 2009, 08:24 PM

      i have started working with XPDO everything is going well with this great ORB
      and in fact i was preparing extended documentation with code examples for XPDO
      There are some others interested in documentation efforts for xPDO. Just indicate your interest, sign up for a user account at Jira, and I’ll give you permission to help author documentation in our Confluence wiki project for xPDO. That would be absolutely wonderful.

      Quote from: venu at May 21, 2009, 08:24 PM

      but i struck when i want to retrieve the results from cache

      please help me how to retrieve the cached results
      i have enabled XPDO_OPT_CACHE_DB=>true
      the result set is stored in the cache directory

      i understand that we need to use fromcache() call but what is the $signature parameter
      i dint understand what value i have to give for this parameter

      anybody please give a brief tutorial about how to use cache in XPDO and i will add this in my ext doc so it wil be usefull for other users also

      thank you
      venu
      Simply, whatever you send in as the signature via toCache(). The xPDO class’s getObject*()/getCollection*() methods, as well as any xPDOCriteria-based queries, take care of this for you. xPDO toCache() and fromCache() are intended specifically for caching SQL result sets for consumption in xPDO methods; you may more interested in using an xPDOCache implementation directly, e.g. here is an example from a MODx component I’m working on for paging result sets and caching the pages:
      <?php
      $cached = false;
      if (!empty($cachePage)) {
          $cacheKey = $modx->resource->getCacheKey() . '/' . ($namespace ? $namespace . '/' : '') . $pageVarKey . '/' . $page;
          $cacheOptions = array(
              XPDO_OPT_CACHE_KEY => $cachePageKey
              ,XPDO_OPT_CACHE_HANDLER => $cachePageHandler
          );
          $cached = $modx->cacheManager->get($cacheKey, $cacheOptions);
      }
      if (empty($cached) || !is_array($cached)) {
          // Code to create the data to cache here...
          $data = doSomethingToGetData();
      
          if (!empty($cachePage)) {
              $cached = $data;
              $modx->cacheManager->set($cacheKey, $cached, (integer) $cachePageTTL, $cacheOptions);
          }
      }
      

      This has the added benefit of allowing you to better partition your cache data according to what you need.
        • 31410
        • 66 Posts
        thanks for your reply with code sample Jason
        i was trying to retrieve sql cache which are saved automatically in the cache folder like cache\objects\ActiveUsers
        the file is saved as 4d8a15e3cc35750f016ce15a43937620.cache.php
        i guess the random number is my criteria hash code
        yes iam working on my custom xpdocache implementation like you said

        and iam registered in jira with venureddy as my username
        let me know how can i contribute in the documentation

        iam eagerly waiting for modx rev beta version for my next project
        i have installed it from SVN but it has some problems with manager interface
        when the beta will be out?

        thanks again for your quick reply
        venu
          • 28215
          • 4,149 Posts
          Quote from: venu at May 22, 2009, 05:06 PM

          and iam registered in jira with venureddy as my username
          let me know how can i contribute in the documentation

          iam eagerly waiting for modx rev beta version for my next project
          i have installed it from SVN but it has some problems with manager interface
          when the beta will be out?

          thanks again for your quick reply
          venu
          venu,

          I can get you set up on helping with Revolution documentation; Jason would be someone to talk with about xPDO documentation - depends on which you’d like to contribute to. Please contact me at [email protected] to proceed further.

          If you could file any manager problems you are having in JIRA, that’d be great. I’m interested to know what sort of manager interface problems you’re having - with the exception of IE 7 (which will not be supported in beta-1, but will in rc1 and onward), it’s working fine for us.

          We are trying to get beta out by the end of May / beginning of June.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 31410
            • 66 Posts
            thanks for your reply splittingred

            sorry i thought opengeek name is jason

            re:documentation i want to contribute on xpdo as i have prepared some ext docs already

            re:revolution i have waited for around 6 months to see revolution beta to be out so i can start working on that without getting much problems
            i understand revolution wont happens over the day smiley
            when i finally got my rev working with SVN last week i was more fascinated about it

            i may not produce code doc for rev but i guess i can produce some good tutorial on how to work with it
            if you can give permissions on rev doc also iam very happy to contribute on that

            re:rev problem i think it was a css absolute position problem in FF 2
            [image attachment is not working here]
            please see the floomby screen shot about the error
            http://data2.floomby.com/files/share/24_5_2009/kpxoTXMOEaSzcFECiYq5w.jpg

            i am also working on increasing modx communities in india, as it is not popular as it should have to be

            once again thank you for your great and quick support
            venu