Hazelcast C++ Client
 All Classes Functions Variables Enumerations Enumerator Pages
NearCacheRecord.h
1 /*
2  * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_CLIENT_INTERNAL_NEARCACHE_NEARCACHERECORD_H_
17 #define HAZELCAST_CLIENT_INTERNAL_NEARCACHE_NEARCACHERECORD_H_
18 
19 #include <assert.h>
20 #include <boost/shared_ptr.hpp>
21 
22 #include "hazelcast/client/internal/eviction/Evictable.h"
23 #include "hazelcast/client/internal/eviction/Expirable.h"
24 
25 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26 #pragma warning(push)
27 #pragma warning(disable: 4251) //for dll export
28 #endif
29 
30 namespace hazelcast {
31  namespace util {
32  class UUID;
33  }
34 
35  namespace client {
36  namespace internal {
37  namespace nearcache {
47  template <typename V>
49  public:
50  static const int64_t TIME_NOT_SET = -1;
51 
57  virtual void setValue(const boost::shared_ptr<V> &value) {
58  assert(0);
59  }
60 
66  virtual void setCreationTime(int64_t time) = 0;
67 
73  virtual void setAccessTime(int64_t time) = 0;
74 
80  virtual void setAccessHit(int32_t hit) = 0;
81 
85  virtual void incrementAccessHit() = 0;
86 
90  virtual void resetAccessHit() = 0;
91 
100  virtual bool isIdleAt(int64_t maxIdleMilliSeconds, int64_t now) = 0;
101 
105  virtual int64_t getInvalidationSequence() const = 0;
106 
110  virtual void setInvalidationSequence(int64_t sequence) = 0;
111 
115  virtual void setUuid(const boost::shared_ptr<util::UUID> &uuid) = 0;
116 
121  virtual bool hasSameUuid(const boost::shared_ptr<util::UUID> &thatUuid) const = 0;
122  };
123  }
124  }
125  }
126 };
127 
128 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
129 #pragma warning(pop)
130 #endif
131 
132 #endif /* HAZELCAST_CLIENT_INTERNAL_NEARCACHE_NEARCACHERECORD_H_ */
virtual void setAccessHit(int32_t hit)=0
Sets the access hit count of this Evictable.
virtual void setCreationTime(int64_t time)=0
Sets the creation time of this Evictable in milliseconds.
virtual void setUuid(const boost::shared_ptr< util::UUID > &uuid)=0
virtual void setValue(const boost::shared_ptr< V > &value)
Sets the value of this NearCacheRecord.
Definition: NearCacheRecord.h:57
An expirable and evictable data object which represents a Near Cache entry.
Definition: NearCacheRecord.h:48
Interface for entries, records or whatever that can be evicted.
Definition: Evictable.h:35
virtual void setAccessTime(int64_t time)=0
Sets the access time of this Evictable in milliseconds.
Expiring Data model interface.
Definition: Expirable.h:37
virtual bool hasSameUuid(const boost::shared_ptr< util::UUID > &thatUuid) const =0
virtual void resetAccessHit()=0
Resets the access hit count of this Evictable to.
virtual bool isIdleAt(int64_t maxIdleMilliSeconds, int64_t now)=0
Checks whether the maximum idle time is passed with respect to the provided time without any access d...
virtual void setInvalidationSequence(int64_t sequence)=0
virtual void incrementAccessHit()=0
Increases the access hit count of this Evictable by.