Caffe2 - C++ API
A deep learning, cross platform ML framework
redis_store_handler.h
1 
17 #pragma once
18 
19 #include <caffe2/distributed/store_handler.h>
20 
21 extern "C" {
22 #include <hiredis/hiredis.h>
23 }
24 
25 #include <string>
26 
27 namespace caffe2 {
28 
30  public:
31  explicit RedisStoreHandler(std::string& host, int port, std::string& prefix);
32  virtual ~RedisStoreHandler();
33 
34  virtual void set(const std::string& name, const std::string& data) override;
35 
36  virtual std::string get(const std::string& name) override;
37 
38  virtual int64_t add(const std::string& name, int64_t value) override;
39 
40  virtual bool check(const std::vector<std::string>& names) override;
41 
42  virtual void wait(
43  const std::vector<std::string>& names,
44  const std::chrono::milliseconds& timeout = kDefaultTimeout) override;
45 
46  private:
47  std::string host_;
48  int port_;
49  std::string prefix_;
50 
51  redisContext* redis_;
52 
53  std::string compoundKey(const std::string& name);
54 };
55 
56 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.