About RCache

RCache is a simple Java objects cache based in weak references.

With this library, a programmer can maintain an in-memory map of arbitrary object instance references. RCache helps the programmer to:

  • reduce the number of object instantiations for short-lived objects
  • ensure that only one instance exists for a given "logical" object
  • improve memory footprint by allowing unused instances to be garbage collected
  • efficiently access to frequently used instances

Project Background

RCache first prototype was designed as a possible solution to a performance problem in a web-service based file server.

The initial goal was to prevent concurrent access to the same file and directory metadata attributes (permissions, aliases, descriptions) through multiple instances.

These metadata attributes were stored in (hidden) files, so there was no transactional mechanisms in place. Obviously, the server had important scalability issues.

A weak reference based cache was one possible workaround to the problem. By ensuring that only one instance exists for a single file, transactionality becomes a simple synchronisation subject.

What is more, caching instances reduced the number of instantiations, increasing the server performance in several orders of magnitude. This performance boost was not surprising, for each Metadata instance had to read several files during its initialisation.

RCache has little, if nothing to do with that first implementation. It has been redesigned from the beginning for general use, and some helper classes have been added to make the developer's life easier.

Roadmap

The priorities for this project will be:

  • Stability: using weak and soft references is a delicate task. This project must be solid-rock.
  • Documentation: No excuses. Anyone needing this library must have the tools to learn by themselves how it works and how to adapt it to their necessities, and how to get the most of it without buying a book at Amazon or attending a seminar. Of course, somebody could publish a book about RCache one day. Even I, if I get time. But in the meantime, this web site should contain everything necessary to become an RCache expert.
  • New features: maybe after 1.0 release. This project is intentionally kept small. While designed to be extended, only those extensions of broad utility will be included in the package.

Said this, the roadmap for the 1.0 release is as follows:

  • Get at least a 75% test coverage.
  • Write a good tutorial.
  • Make sure Javadoc brings useful information.
  • Add "real-world" examples to the source code and to the documentation

Last, but not least, if you think this project can help you, please, let me know.