We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41874
    • 33 Posts
    Hi there,

    I'm looking for a way to clear cache entries by pattern. I'm caching representations of objects and when an object is updated i would like to clear the cache for that object.

    For example I have the following cache keys: object-1-small, object-1-big, object-1-empty etc. Now the following would delete all representations of all objects.
    $cacheOpts = $options = array(
      xPDO::OPT_CACHE_KEY => "my-custom-cache"
    );
    $modx->cacheManager->clean($cacheOpts);


    I would like to delete from a pattern (eg: object-[id]-*) within the folder "my-custom-cache".

    Is this possible?

    Thanks in advance!
      I love flexibility