• Advertisement
Sign in to follow this  

Implementing an efficient memory cache (or choosing an existing library)

Recommended Posts

Hi!

I'm writing a procedural voxel->polygon engine and I need to frequently generate/save/load and destroy chunks.

I'd like to avoid regenerating, and especially loading (== touching the disk) chunks, which have been recently used, by employing a memory cache.

Ideally, I'd like to reserve a fixed-size memory block for the 'chunk cache', address cached chunks by their IDs and specify chunk eviction policy/expiration time.

 

How to best implement such a cache? (i.e. fast and efficient, no fragmentation.)

Could you give me any references to existing implementations?

 

I found these libraries, but they seem too 'heavy' for my toy voxel engine:

http://cachelot.io/ and memcached

Is there anything more lightweight?

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement