786044a5a94ce53307fd1de645b8877de1297af9
[gssweb.git] / json_gssapi / src / cache / GSSContextCache.h
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  *
4  * For license details, see the LICENSE file in the root of this project.
5  *
6  */
7
8 #ifndef GSSCONTEXTCACHE_H
9 #define GSSCONTEXTCACHE_H
10
11 #include <map>
12 #include <string>
13
14 #include "datamodel/GSSContext.h"
15
16 typedef std::map<std::string, GSSContext> ContextMap;
17
18 class GSSContextCache
19 {
20 public:
21     static GSSContextCache* instance();
22     std::string store(GSSContext &data, const std::string key = "");
23     GSSContext &retrieve(std::string key);
24
25 protected:
26     GSSContextCache();
27     ~GSSContextCache();
28
29 private:
30     ContextMap contexts;
31     
32     bool generateKey(std::string &key);
33     
34     static GSSContextCache* _instance;
35 };
36
37 #endif // GSSCONTEXTCACHE_H