13 #ifndef __NET_CACHE_H__
14 #define __NET_CACHE_H__
53 return generateKey(myKeyPrefix, key,
version);
81 if (
get(key, v, v, ec,
version))
134 for (
auto&& key : keys)
140 results[key] =
value;
151 for (
auto&& key : keys)
154 if (
get(key, value, -1,
nullptr,
version))
156 results[key] =
value;
169 if (!
get(key, value, value, tec,
version))
177 get(key, def, -1, tec,
version);
190 if (!
get(key, value, def, ec,
version))
194 get(key, def, -1, ec,
version);
229 if (!
get(key, value, def, ec,
version))
257 if (
get(key, value, value, ec,
version))
259 value = value + delta;
260 return set(key, value, ec, -1,
version);
271 return incr(key, value, -delta, ec,
version);
279 for (
auto&& [key,
value] : data)
290 for (
auto&& [key,
value] : data)
301 for (
auto&& key : keys)
315 if (
get(key, value, value, ec,
version))
317 if (!set(key, value, ec, -1,
version + delta))
333 return incrVersion(key, -delta, ec,
version);
355 int myDefaultTimeout = 300;
356 int myMaxEntries = 300;
357 int myCullFequency = 3;
360 int myDefaultVersion = 1;
445 for (
auto&& key : ks)
448 doRemoveMany_(keys, oec);
494 #endif // __NET_CACHE_H__
virtual int64 getBackendTimeout(int64 timeout=-1)
UT_NON_COPYABLE(NET_ICache)
virtual bool touch(const UT_StringRef &key, UT_ErrorCode *ec=nullptr, int timeout=-1, int version=-1)=0
virtual int getOrSet(const UT_StringRef &key, int_def_clb_t &&clb, UT_ErrorCode &ec, int64 timeout=-1, int version=-1)
bool set(const UT_StringHolder &key, int value, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1) override
GT_API const UT_StringHolder time
void removeMany(const UT_StringArray &keys, UT_ErrorCode *ec=nullptr, int version=-1) override
GLsizei const GLfloat * value
virtual UT_StringArray setMany(const UT_Map< UT_StringHolder, UT_StringHolder > &data, int64 timeout=-1, int version=-1)
virtual bool hasKey(const UT_StringRef &key, UT_ErrorCode *ec=nullptr, int version=-1)
virtual void close(UT_ErrorCode *ec=nullptr)
virtual bool decr(const UT_StringRef &key, int &value, int delta=1, UT_ErrorCode *ec=nullptr, int version=-1)
virtual bool incr(const UT_StringRef &key, int &value, int delta=1, UT_ErrorCode *ec=nullptr, int version=-1)
virtual int incrVersion(const UT_StringRef &key, int delta=1, UT_ErrorCode *ec=nullptr, int version=-1)
size_t appendFormat(const char *fmt, const Args &...args)
UT_StringHolder myKeyPrefix
virtual UT_StringHolder generateKey(const UT_StringHolder &key_prefix, const UT_StringHolder &key, int version)
UT_StringHolder makeKey(const UT_StringHolder &key, int version=-1)
GLbitfield GLuint64 timeout
static const UT_StringHolder theEmptyString
UT_Function< int(UT_ErrorCode &ec)> int_def_clb_t
virtual bool set(const UT_StringHolder &key, int value, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1)
virtual void getMany(const UT_StringArray &keys, UT_Map< UT_StringHolder, UT_StringHolder > &results, UT_ErrorCode *ec=nullptr, int version=-1)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
virtual UT_StringHolder getOrSet(const UT_StringRef &key, const UT_StringHolder &def, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1)
size_t format(const char *fmt, const Args &...args)
Format a string using the same formatting codes as UTformat.
std::function< T > UT_Function
GT_API const UT_StringHolder version
std::error_code UT_ErrorCode
virtual void removeMany(const UT_StringArray &keys, UT_ErrorCode *ec, int version=-1)
SYS_FORCE_INLINE void append(char character)
virtual int decrVersion(const UT_StringRef &key, int delta=1, UT_ErrorCode *ec=nullptr, int version=-1)
UT_Function< UT_StringHolder(UT_ErrorCode &ec)> str_def_clb_t
virtual void clear(UT_ErrorCode *ec=nullptr)=0
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
virtual int getOrSet(const UT_StringRef &key, int def, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1)
virtual UT_StringHolder getOrSet(const UT_StringRef &key, str_def_clb_t &&clb, UT_ErrorCode &ec, int64 timeout=-1, int version=-1)
virtual bool add(const UT_StringHolder &key, int value, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1)
virtual void getMany(const UT_StringArray &keys, UT_Map< UT_StringHolder, int > &results, UT_ErrorCode *ec=nullptr, int version=-1)
bool add(const UT_StringHolder &key, int value, UT_ErrorCode *ec=nullptr, int64 timeout=-1, int version=-1) override
virtual UT_StringArray setMany(const UT_Map< UT_StringHolder, int > &data, int64 timeout=-1, int version=-1)