OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AtomCache.h
Go to the documentation of this file.
1 
13 #ifndef _OPENCOG_ATOM_STORAGE_H
14 #define _OPENCOG_ATOM_STORAGE_H
15 
16 #ifdef HAVE_LIBMEMCACHED
17 
18 #include <string>
19 #include <memcached.h>
20 
21 #include <opencog/atomspace/Atom.h>
23 
24 namespace opencog
25 {
30 class AtomCache
31 {
32  private:
33  memcached_st *mc;
34  memcached_return connect_status;
35 
36  unsigned long store_count;
37  bool store_cb(Atom *);
38 
39  int depth(Atom *);
40  int maxdepth;
41 #define MAX_LATTICE_DEPTH 20
42  std::string depth_list[MAX_LATTICE_DEPTH];
43 
44  unsigned long load_count;
45  void load_list(AtomTable &, int);
46 
47  public:
48  AtomCache(const std::string server, int portno);
49  ~AtomCache();
50 
51 
52  void storeAtom(Atom *);
53  Atom * getAtom(Handle);
54  void load(AtomTable &);
55  void store(const AtomTable &);
56 };
57 
59 }
60 
61 #endif // HAVE_LIBMEMCACHED
62 
63 #endif // _OPENCOG_ATOM_STORAGE_H