caching - removing by partial key

I'm sure this has been answered somewhere, but for the life of me I
couldn't find it.

I am setting a cache suffix for the purpose of caching stuff for a
user/session. Is it possible to dump those values from cache once the
user logs out or the session expires? How would that be accomplished?

Try this method from the CacheBoxProvider class
clearByKeySnippet
public void clearByKeySnippet(any keySnippet, [any<boolean> regex='false'], [any<boolean> async='false'])
  Clears keys using the passed in object key snippet

    Parameters:
    keySnippet - the cache key snippet to use
    regex - Use regex or not
    async - Run command asynchronously or not
That being said, CacheBox can store items in a given scope. For instance, session.
THAT being said, is there are particlar benifit to use cachebox at all? You could just slap whatever you need directly into the session plugin.

~Brad

Thanks, Brad - I'll give that a shot!

I gather it would look something like this?

getColdboxOCM().clearByKeySnippet("cache-string", false, false); //
clear anything containing this substring: "cache-string"
getColdboxOCM().clearByKeySnippet("cache-suffix-string$", true,
false); // clear anything ending with cache-suffix-string

I'm using the built in event caching for convenience more than
anything. There are certain events/views which are better cached, but
contain user-specific information (i.e. usernames etc). I hadn't
really considered doing it manually but you might be right in terms of
it being a viable alternative. What I have currently works just fine -
but there are nuances with cleaning it up when a user logs out (and I
don't want all those views hanging around needlessly).

I'm having trouble making this work. Actually I can't seem to make
*anything* disappear from the cache, short of fwreinit.

I have a bunch of views which are cached using a suffix (e.g. XXX). I
can't for the life of me make these go away (de-cache). I have tried
the following ways:

// remove by snippet
getColdboxOCM().clearByKeySnippet("XXX$", true, false);
getColdboxOCM().expireByKeySnippet("XXX$", true, false);

// or just remove everything
getColdboxOCM().clearAll();
getColdboxOCM().expireAll();

When I refresh the report in the cachebox monitor my views are still
sitting there with status "alive". I can manually expire/delete them
one by one using the buttons in the "CMDS" column. The "Clear All
Views" button appears to not work at all (bug). If you launch
something like Fiddler and watch the response I get this:

index.cfm?cbox_command=clearallviews&cbox_cacheName=TEMPLATE
coldfusion.runtime.UndefinedElementException: Element ASYNC is
undefined in ARGUMENTS.
  at
cfCacheBoxColdBoxProvider2ecfc1858456712$funcCLEARALLVIEWS.runFunction(coldbox
\system\cache\providers\CacheBoxColdBoxProvider.cfc:170)
  at cfColdbox2ecfc310293259$funcCOLDBOXCOMMANDS.runFunction(coldbox
\system\Coldbox.cfc:584)
  at
cfColdbox2ecfc310293259$funcPROCESSCOLDBOXREQUEST.runFunction(coldbox
\system\Coldbox.cfc:199)

Same goes for Clear All Events. This is in CB3.1

Incidentally is "clear" the same as "delete"? I wasn't sure of the
distinction between "expire" and "clear" and "delete".

Ok your problem is you are talking to the wrong cache provider. As it was introduced in coldbox 3.0 you have two cache provider regions: default for plugins, handlers and data. "template" for views and event caching. So you need to talk to the template cache

Getcoldboxocm("template") or
Cachebox.getCache("template")

shazam - that's got it. Thanks Luis.

The "clear all" buttons in the cache monitor are still an issue. Incidentally I tried it in 3.5 beta and they are broken there, too.