Can JCS have update events?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can JCS have update events?

robert lazarski
Hi all,

I am coding a simple local "Indexed Disk Auxiliary Cache" and
IsEternal=true using JCS, and I can't figure out how to have an
onUpdate() event. Is there update events in JCS?

I am a bit confused on IElementEventConstants since they are seemingly
for expiration and disk spooling, not actual changes in the cache
values.

I looked at the JCS implementation of JCache events and it looks like
what I need, but I can't figure out how to do disk persistence with
JCS / JCache as I can't find any code examples.

So I am a bit stuck - can't figure out how to do update events using
JCS, and can't figure out how to do do disk persistence with JCS /
JCache. I'm open to either one. Any help appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Can JCS have update events?

Thomas Vandahl
Please use [jcs] as a prefix to the subject when posting to
[hidden email].

On 06.04.17 18:21, robertlazarski . wrote:
> I am coding a simple local "Indexed Disk Auxiliary Cache" and
> IsEternal=true using JCS, and I can't figure out how to have an
> onUpdate() event. Is there update events in JCS?

Why are you coding the cache? This should only need configuration. Why
do you think you need update events?

> I looked at the JCS implementation of JCache events and it looks like
> what I need, but I can't figure out how to do disk persistence with
> JCS / JCache as I can't find any code examples.

Did you read the docs at
https://commons.apache.org/proper/commons-jcs/IndexedDiskAuxCache.html?
The configuration example on that page is basically all you need. See
https://commons.apache.org/proper/commons-jcs/JCSPlugins.html for a
description of JCS' concept of auxiliaries.

Bye, Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Can JCS have update events?

robert lazarski
On Sat, Apr 8, 2017 at 7:13 AM, Thomas Vandahl <[hidden email]> wrote:
> Please use [jcs] as a prefix to the subject when posting to
> [hidden email].

Got it, thanks for the response.

>
> On 06.04.17 18:21, robertlazarski . wrote:
>> I am coding a simple local "Indexed Disk Auxiliary Cache" and
>> IsEternal=true using JCS, and I can't figure out how to have an
>> onUpdate() event. Is there update events in JCS?
>
> Why are you coding the cache? This should only need configuration. Why
> do you think you need update events?
>

Sorry I was not clear - I really meant configuring an "Indexed Disk
Auxiliary Cache" per the docs and using ICache and CacheAccess etc for
my project code implementation. Nothing out of the ordinary.

We need update events because our code already uses them - we are
replacing our current cache libs (ehcache) with another lib -
preferably JCS.

More specifically, our local cache is filled with stock prices via a
"HTTP server push" stream and on updates we need to perform some
additional calculations using events and listeners.

>> I looked at the JCS implementation of JCache events and it looks like
>> what I need, but I can't figure out how to do disk persistence with
>> JCS / JCache as I can't find any code examples.
>
> Did you read the docs at
> https://commons.apache.org/proper/commons-jcs/IndexedDiskAuxCache.html?
> The configuration example on that page is basically all you need. See
> https://commons.apache.org/proper/commons-jcs/JCSPlugins.html for a
> description of JCS' concept of auxiliaries.
>
> Bye, Thomas
>

The docs mention 4 auxiliaries: (1) memory, (2) disk, (3) lateral, and
(4) remote. I need 1 and 2 but also with update events and a listener.

If I can get an IndexedDiskAuxCache working using typical onUpdate()
events and a listener that would be ideal. Actually I not only read
the docs but also the source code.

I looked a lot at the JCS code and didn't find update events, which is
why I looked at the JCS JCache implementation. Apparently JSR-107
didn't define persistence though. I notice some other projects have a
JSR-107 "CacheStore" for disk persistence but to be clear I definitely
want to use JCS.

Saying this as humbly as possible as clearly I am not a Cache expert ,
I am an Apache Axis2 committer plus I have done several Linux related
contributions and I would be willing to submit patches if I end up
having to "scratch my own itch" . Of course though I would rather use
an API that already exists.

Kind regards,
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jcs] Re: Can JCS have update events?

Thomas Vandahl
On 08.04.17 14:40, robertlazarski . wrote:
> We need update events because our code already uses them - we are
> replacing our current cache libs (ehcache) with another lib -
> preferably JCS.
>
> More specifically, our local cache is filled with stock prices via a
> "HTTP server push" stream and on updates we need to perform some
> additional calculations using events and listeners.

Although I strongly believe that this should be handled outside the
scope of the cache, I think that update events could be added to JCS
quite easily.

JCS does not support this at the moment. The best place to add such a
feature probably would be CompositeCache.update() and remove(),
respectively. Please be sure to take the asynchronous nature of event
handling into account.

> I looked a lot at the JCS code and didn't find update events, which is
> why I looked at the JCS JCache implementation. Apparently JSR-107
> didn't define persistence though. I notice some other projects have a
> JSR-107 "CacheStore" for disk persistence but to be clear I definitely
> want to use JCS.

The JCache implementation actually is just a wrapper around JCS, so all
features of JCS, including the disk auxiliary should be available from
JCache, too. I'm only maintaining the core of JCS, so I cannot speak
from JCache experiences here.

> Saying this as humbly as possible as clearly I am not a Cache expert ,
> I am an Apache Axis2 committer plus I have done several Linux related
> contributions and I would be willing to submit patches if I end up
> having to "scratch my own itch" . Of course though I would rather use
> an API that already exists.

Patches are always welcome.
However I still suggest to reconsider putting data manipulations into
the scope of the cache, independently of the library used.

Bye, Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]