Hi, thanks for your question. I'm not a JCS expert by any means so I'm not
sure the answer to your question but I do have a question myself. What's
the reason for wanting to clear the cache in these cases rather than just
getting no result back so that you just refresh that value?

On Fri, 22 Jan 2021, 07:26 Stuart Maclean, <macl...@mrvsys.com> wrote:

> I am using JCS 2.2. I am an infrequent user of JCS, so please bear with
> me.  I have checked the mail list archives for past few years, couldn't
> find any answers to this q...
>
> I have a cache region whose key type is say String and whose value type
> is some class C.  C is Serializable.
>
> I use the cache, so objects of class C go into that region. The cache is
> backed by disk, so objects of class C end up in files.
>
> C may then change, such that its serialVersionUID changes. If so, what I
> want to happen is that when I do a
>
> C c = cache.get( "K" );
>
> I would like to see the InvalidClassException, so that I can call
>
> cache.clear()
>
> and start over with the 'new' C objects.
>
> But cache.get() doesn't throw such an error.  I always get a null result
> back, which means I can't distinguish this type of error from a simple
> cache miss (key not present), so I can't call the cache.clear().
>
> Somewhere in the call stack, JCS is catching the error so that it
> doesn't propogate to user code?
>
> Are there any api calls I can make to set the cache up so that it is
> cleared on this type of error?
>
> Thanks
>
> Stu
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>

Reply via email to