(
void);
47 virtual int Run(
void);
93TSimpleCache cache(100);
95 for(
int i= 0;
i< 1000;
i++) {
97TSimpleCache::EAddResult
result;
98cache.Add(
i, element, 1, 0, &
result);
103 for(
int i= 0;
i< 1000;
i++) {
107 _ASSERT(element->GetSize() == (
size_t)
i*10);
162THeapCache cache(100);
164 for(
int i= 0;
i< 1000;
i++) {
166THeapCache::EAddResult
result;
167cache.Add(
i, element, 1, 0, &
result);
171 for(
int i= 0;
i< 1000;
i++) {
240 for(
int i= 0;
i< 1000;
i++) {
242TMemCache::EAddResult
result;
243cache.Add(
i, element, 1, 0, &
result);
253 for(
int i= 0;
i< 1000;
i++) {
254TElement element = cache.Get(
i);
256 _ASSERT(element->GetSize() == (
size_t)
i*10);
320TEmptyOnOverflowCache cache(1);
321 for(
int i= 0;
i< 1000;
i++) {
323TEmptyOnOverflowCache::EAddResult
result;
324cache.Add(
i, element, 1, 0, &
result);
326 _ASSERT(cache.GetSize() == 1);
329 for(
int i= 0;
i< 1000;
i++) {
330TElement element = cache.Get(
i);
332 _ASSERT(element->GetSize() == (
size_t)
i*10);
341 int main(
intargc,
const char* argv[])
344 returnapp.
AppMain(argc, argv);
const size_t kMaxOverflowCacheSize
int main(int argc, const char *argv[])
const size_t kMaxMemCacheSize
virtual void Init(void)
Initialize the application.
void SimpleCacheDemo(void)
void MemoryCacheDemo(void)
virtual int Run(void)
Run the application.
void EmptyOnOverflowDemo(void)
ECache_InsertFlag CanInsertElement(const int &, const CRef< CObjElement > &value)
~CDemoHandler_EmptyOnOverflow(void)
void RemoveElement(const int &, CRef< CObjElement >)
void InsertElement(const int &, const CRef< CObjElement > &)
CRef< CObjElement > CreateValue(const int &)
CDemoHandler_EmptyOnOverflow(void)
void RemoveElement(const int &, CHeapElement *value)
CHeapElement * CreateValue(const int &)
void InsertElement(const int &, CHeapElement *)
ECache_InsertFlag CanInsertElement(const int &, const CHeapElement *value)
CRef< CObjElement > CreateValue(const int &)
void InsertElement(const int &, const CRef< CObjElement > &value)
ECache_InsertFlag CanInsertElement(const int &, const CRef< CObjElement > &value)
~CDemoHandler_MemSize(void)
CDemoHandler_MemSize(void)
void RemoveElement(const int &, CRef< CObjElement > value)
CHeapElement(size_t size)
size_t GetSize(void) const
CNoLock is a simple no-op lock which does no real locking.
size_t GetSize(void) const
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
ECache_InsertFlag
Flag indicating if an element can be inserted into cache.
@ eCache_CanInsert
The element can be inserted.
@ eCache_DoNotCache
The element can not be inserted (e.g. too big)
@ eCache_CheckSize
Insert the element after checking max cache size.
@ eCache_NeedCleanup
Need to cleanup cache before inserting the element.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
The NCBI C++ generic cache template.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4