Skip to content

zapredelom/expirationCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple header only c++ template class for expiration cache. put your key type, value type and TTL for current instance and you are ready. lib is thread safe, and use one thread for all instances across the application

usage:

#include <iostream>
#include "ExpirationCache.h"
int main ()
{
  ExpirationCache<int/*keyType*/, int/*value type*/, 4/*TTL*/> e1;
  e1.Put(1,2);
  e1.Put(2,3);
  try
  {
    auto val2 = e1.Get(33);
  }
  catch(std::out_of_range&e)
  {
    //value was not found in cache
    std::cout<<e.what()<<std::endl;
  }
  return 0;
}

About

inmemory c++ cache with TTL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published