Hi all, I'm working away on the kmusicbrainz library and one of the things I want to do is create a query cache so that common lookups don't need to always wait on the network or can be retrieved from cache when the client is not connected to the net.

The queries themselves are typically either a UUID type string, an artist or album name or a disc Id string. The results are chunks of XML. Is there a standard key / value style string caching mechanism in any of the libs or that could be borrowed from an application?

If not, what approach would anyone suggest to an issue like this? I'd like to have a few features supported:
1. query aging: after a (configurable) period of time, a known query should go stale so it can be re queried and the data refreshed
2. Performant for string keys: sadly most of the keys will be strings (sometimes pretty aribitary ones) so fast string key lookup would be a good thing (tm)

If I end up writing this from scratch, would a file approach be best or should I look at using sqllite or similar?

cheers
Nathan