Skip to content(if available)orjump to list(if available)

Value-pool based caching for Java applications

NBJack

This sounds useful, but the lengthy attempt to describe what it solves is rather confusing. Is it caching a list? An actual type of object? The type of the object itself?

The diagram, clearly well-intentioned, doesn't really answer my questions either. I'll note the lack of discussion on memory safety gives me pause, but I see evidence of such in the code.

> Once the library is configured for the project, the first thing you need to do is to define the IDs of the objects to be cached.

I'm certain they mean tag the identifier fields used by objects. At first glance, this sounded like a hyper-specific shortlist of objects cached based on their runtime ID values.

> Write more elaborate and cleaner documentation

Please friend; make it concise and clear first.

Fabricio20

The key explanation is:

> Whenever a method is invoked with some arguments, those are used as a key that is mapped to IDs instead of objects. The objects are then retrieved and returned from the ValuePool via their IDs.

You store the actual value on this value map, and then have a bunch of maps with references to this value map. When you update the entity, you can update the cache by updating "just" the value map. All other maps are automatically "updated" because they just reference the identifier (no-op). So you query these other maps to get the list of identifiers, then pull the actual values from the value map.

I get what its trying to do, its just not clear to me how it would handle updating the key-reference maps. If I change the value of a field (say name on a user entity), does it know to remove that entry (user_name_age map as an example) from the references map?

> The caches of the methods are only linked to IDs instead of transaction objects, so we won't need to update something there as long as an object is not deleted.