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 
52  virtual ~NearCacheRecord() { }
53 
59  virtual void setValue(const boost::shared_ptr<V> &value) {
60  assert(0);
61  }
62 
68  virtual void setCreationTime(int64_t time) = 0;
69 
75  virtual void setAccessTime(int64_t time) = 0;
76 
82  virtual void setAccessHit(int32_t hit) = 0;
83 
87  virtual void incrementAccessHit() = 0;
88 
92  virtual void resetAccessHit() = 0;
93 
102  virtual bool isIdleAt(int64_t maxIdleMilliSeconds, int64_t now) = 0;
103 
107  virtual int64_t getInvalidationSequence() const = 0;
108 
112  virtual void setInvalidationSequence(int64_t sequence) = 0;
113 
117  virtual void setUuid(const boost::shared_ptr<util::UUID> &uuid) = 0;
118 
123  virtual bool hasSameUuid(const boost::shared_ptr<util::UUID> &thatUuid) const = 0;
124  };
125  }
126  }
127  }
128 };
129 
130 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
131 #pragma warning(pop)
132 #endif
133 
134 #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:59
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.