Giter Site home page Giter Site logo

ephemera's Introduction

Ephemera

An In-Memory, Write-Only, Header-Only, Key-Value Cache Library

Build Status

C/C++ CI

Requirements

  • Include include/ephemera.h.
  • The libpthread library is required (see Makefile for compilation options).
  • User must provide a data type for the template (see include/data.h for an example). Optionally the user should provide a custom output stream function for their data type.

Usage

  • Create an instance of Ephemera<T> ec;, where is T is the user supplied data type to be stored.
  • Spawn the cache expiry thread: std::thread cacheExpiry(Ephemera<T>::cacheExpiryLoop, std::ref(ec));
  • After spawning cache expiry thread, the following: cacheExpiry.join(); will block until the cache expiry thread re-joins the main thread.
  • A signal handler should be used to set Ephemera<T>::Active to false to shutdown the cache expiry thread gracefully.
  • To insert a new key-value pair: bool success = ec.set(key, value, ttl); (the default ttl is 60 seconds)
  • To retrieve the value for a key: bool found = ec.get(key, &value);

Features

  • Simple API: set and get
  • User-specified data type

Limitations

  • Does not include commands to update or delete a key.
  • Negative expiry times are not permitted.

Examples

  • See examples in the src directory
  • To build examples, run: make all

ephemera's People

Contributors

ccapo avatar

Watchers

 avatar  avatar

ephemera's Issues

Planned Update and Delete options?

Hello,

I am searching for a since and simple cross-platform KV library in C/C++ and came across your Repo.

In my reading, it seems that Update and Delete are not implemented and I was wondering if that was planned?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.