20#ifndef GEODE_CACHEABLEKEY_H_
21#define GEODE_CACHEABLEKEY_H_
24#include <unordered_map>
25#include <unordered_set>
27#include "Serializable.hpp"
28#include "internal/functional.hpp"
29#include "internal/geode_globals.hpp"
59 static std::shared_ptr<CacheableKey>
create(_T value);
62 inline static std::shared_ptr<CacheableKey> create(
63 const std::shared_ptr<_T>& value) {
68 inline std::size_t operator()(
const CacheableKey& s)
const {
72 inline std::size_t operator()(
const CacheableKey*& s)
const {
76 inline std::size_t operator()(
77 const std::shared_ptr<CacheableKey>& s)
const {
83 inline bool operator()(
const CacheableKey& lhs,
84 const CacheableKey& rhs)
const {
88 inline bool operator()(
const CacheableKey*& lhs,
89 const CacheableKey*& rhs)
const {
90 return (*lhs) == (*rhs);
93 inline bool operator()(
const std::shared_ptr<CacheableKey>& lhs,
94 const std::shared_ptr<CacheableKey>& rhs)
const {
95 return (*lhs) == (*rhs);
101 CacheableKey(
const CacheableKey& other);
102 void operator=(
const CacheableKey& other);
105using apache::geode::client::internal::dereference_equal_to;
106using apache::geode::client::internal::dereference_hash;
108using HashMapOfCacheable =
109 std::unordered_map<std::shared_ptr<CacheableKey>,
110 std::shared_ptr<Cacheable>,
111 dereference_hash<std::shared_ptr<CacheableKey>>,
112 dereference_equal_to<std::shared_ptr<CacheableKey>>>;
114using HashSetOfCacheableKey =
115 std::unordered_set<std::shared_ptr<CacheableKey>,
116 dereference_hash<std::shared_ptr<CacheableKey>>,
117 dereference_equal_to<std::shared_ptr<CacheableKey>>>;
126struct hash<apache::geode::client::CacheableKey> {
128 typedef size_t result_type;
129 result_type operator()(
const argument_type& val)
const {
Represents a cacheable key.
Definition CacheableKey.hpp:40
virtual bool operator==(const CacheableKey &other) const =0
return true if this key matches other.
static std::shared_ptr< CacheableKey > create(_T value)
Factory method that creates the key type that matches the type of value.
virtual int32_t hashcode() const =0
return the hashcode for this key.
This base class is the superclass of all user objects in the cache that can be serialized.
Definition Serializable.hpp:53