Compared to the overhead you pay for the list and the objects that make
up your values the overhead of an additional object that encapsulates
values and counts seems negligible. This smells a bit like premature
optimization.
May be. I did not yet do any real memory consumption test. I probably
will do really soon. But until then I think, every object counts - at
least for objects in the global cache (that will go into old-gen) and
for numbers of objects growing with the size of the cache.
I'm also a bit annoyed, because the functionality I need is neither
difficult to implement (for the JCF) nor ugly design. My way of storing
the hits counter may be ugly, but providing the getKey functionality is
not. It's a one-line-method, and it has just been forgotten.
Not that I want to do any JCF-bashing. In fact I think, JCF is one of
the most well designed libraries ever written for Java. And Java is one
of the best (general purpose) programming languages ever implemented.
Just out of curiosity: what features does your persistence framework
provide that existing frameworks do not?
I really like static type safety. Within my framework, its a
compile-time error to assign a double value to a persistent field of
type string. Its also a compile-time error to compare a string field to
a double value (or a double field) within a database query. Same with
using the "like" operator on a double field. And of course, queries for
customer objects return a Collection<Customer>. Removing a persistent
field or class from the schema gives you compile-time errors, whereever
you used it (including database queries of course, not just
getters/setters). Renaming a persistent field or class using a modern
Java IDE really renames all references to that field, including those
in queries. No more "column not found"-SQLExceptions. I *hate* writing
database queries in some plain text language.
Second I don't like writing XML (or any other external, non-java)
description of the persistent schema. Within COPE (did I mention the
name of the framework already

), everything is specified within
your Java source code. Everything. Persistent classes, fields,
constraints, queries.
And I want support for migrating the database to new versions of the
application without loss of data. For instance, if you add a new
persistent field to the schema you must not forget to add a new column
to the database table. For COPE there is a helper application telling
you which column (or table or constraint) is missing (or not used any
longer) and lets you create (drop) it with a single click. I really
missed this in my projects, because it's another typical source of that
"column not found"-SQLExceptions.
And I don't want to waste my time remembering, which column type can
store a string up to 400 characters most efficiently with that
particular database I'm using right now. Was it "varchar(400)" or
"varchar2(400)" or "text" or "tinytext" or just "string" ? Grmpf. COPE
does that for you.
Ooops. Got a bit lengthy

.
And of course the cache will be the most effifcient on earth when it's
ready, but it's not yet.
There is also a website, with some explanation:
http://cope.sourceforge.net/
http://news.individual.net/
Pretty reliable and a lot of groups but comes with a small cost. I was
annoyed with trouble I had with free newsservers so I switched over.
Thanks a lot. I just registered.
Best regards,
Ralf.