On Tue, 10 Sep 2002, Stefan Schwarzer wrote:
> On 2002-03-31, Tavis started a discussion on a caching framework.
> Since we'll need a (or several) application-wide (not servlet-wide)
> cache in our project, I wanted to hear whether anybody has worked on
> this theme.
>
> If not, we would code a Cache class and give it to the community
> though our requirements are surely "lower" than that what Tavis
> outlined in his mail. :-)
>
> We probably "only" need:
>
> - multiple application-wide caches
> - thread-safe
> - not necessarily persistent (though that would be fine)
> - caching by automatically assigned unique id (at least per cache) or
>   key set to a certain value
> - automatic cache cleaning based on expiration date (or maybe other
>   criteria)

I now have a cache module, together with a unit test. For use in a
application class I coded a (hopefully thread-safe) "single
updater/multiple reader" cache which I'll extend/modify as we proceed
in our project.

I would like to offer the module under the BSD license. What is the
most appropriate way to contribute the code, if I also would like to
get some feedback on something in the code? Should I send it inline to
the list, send it as attachment, submit it as a patch (which it
actually isn't ;-) ), send it some webware developer who will check it
in, or get CVS write access myself? :-) (In the latter case: Can I
submit the code space-indented, as we use that in our project, and
it's not nice to always convert the code. Or is there even an
automated conversion as could be done via the CVS `commit` file?)

The following of the above-mentioned aims are reached in this module:

> - multiple application-wide caches

are possible by using multiple instances

> - thread-safe

yes, but I could need an advice on one place in the code

> - not necessarily persistent (though that would be fine)

no; actually, the cache updater (so far) _reads_ from the database

> - caching by automatically assigned unique id (at least per cache) or
>   key set to a certain value

The value currently is determined by the ids of the rows in the database.

> - automatic cache cleaning based on expiration date (or maybe other
>   criteria)

There's an periodically running update thread. Clients which have
notified the cache see a consistent view of the cache's overall
contents. As long as at least one client hasn't released the cache,
e. g. reads from the database can proceed, but only when no client is
active, the "view" of the data changes. That shouldn't be a problem as
long as there are "infinitely" short times so the (yet blocking)
update thread can get control.

> The intended primarily purpose of these caches is to store HTML output
> or objects that have been read from the database and can easily be
> "turned into HTML".

At the moment the mentioned cache is used to get data for application
objects from the database and build them from the data. Because that
takes several seconds it isn't done every time another object uses
this data.

> We won't be able to invest more than the necessary work to satisfy our
> project's needs but if someone has ideas or suggestions, or want to
> participate, please tell me. :)

I'm relatively sure that we will need the global page cache also but
can't promise anything when.

Stefan




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to