Skip to content

Thread-safe cache for in-memory key-value store that can be used in C++ programs

Notifications You must be signed in to change notification settings

fritzwill/simplified-memcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thread-Safe Cache for in-memory Key-Value Store.

Overview

This is meant to be a simplified version of memcached. This library is also thread-safe meaning that the this implementation supports concurrent access to the cache

Directory Structure

src/: Contains examples of using the library. Each of these files utilizes the cache by importing the library and using its functionality within the program

include/: Contians the implemntation of the classes needed for the library

bin/: This is the target directory for the Makefile to place the binaries compiled from src

tests/: Contains unit tests for the classes along with a script to collect useful time statistics when using the cache while calculating fibonacci numbers (see 'experiments.sh')

Using the Cache in Code

// Declaring a HTCache object in code
HTCache<int64_t, bool> cache(addrelen, pagesize, policy, handler)

The above maps int64_t to bool value. The following describes the variables:

  • addrlen = address space in terms of number of bits
  • pagesize = size of each page in terms of number of entries
  • eviction = eviction policy (FIFO, Random, LRU, Clock)
  • handler = function to call when requested item is missing from cache
// Storing key-value
cache.put(key, value);

// Retrieve value from key
cache.get(key);

About

Thread-safe cache for in-memory key-value store that can be used in C++ programs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published