3
MediaTomb - http://www.mediatomb.cc/
5
storage_cache.h - this file is part of MediaTomb.
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
Leonhard Wimmer <leo@mediatomb.cc>
14
MediaTomb is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License version 2
16
as published by the Free Software Foundation.
18
MediaTomb is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
23
You should have received a copy of the GNU General Public License
24
version 2 along with MediaTomb; if not, write to the Free Software
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
27
$Id: storage_cache.h 2010 2009-01-11 19:10:43Z lww $
30
/// \file storage_cache.h
32
#ifndef __STORAGE_CACHE_H__
33
#define __STORAGE_CACHE_H__
35
#include "zmmf/zmmf.h"
39
#include "cache_object.h"
41
#define STORAGE_CACHE_CAPACITY 29989
42
#define STORAGE_CACHE_MAXFILL 9973
44
class StorageCache : public zmm::Object
49
zmm::Ref<CacheObject> getObject(int id);
50
zmm::Ref<CacheObject> getObjectDefinitely(int id);
51
bool removeObject(int id);
54
zmm::Ref<zmm::Array<CacheObject> > getObjects(zmm::String location);
55
void checkLocation(zmm::Ref<CacheObject> obj);
57
// a child was added to the specified object - update numChildren accordingly,
58
// if the object has cached information
59
void addChild(int id);
63
zmm::Ref<Mutex> getMutex() { return mutex; }
71
void ensureFillLevelOk();
73
zmm::Ref<DBOHash<int,CacheObject> > idHash;
74
zmm::Ref<DSOHash<zmm::Array<CacheObject> > > locationHash;
75
zmm::Ref<Mutex> mutex;
78
#endif // __STORAGE_CACHE_H__