Aggiunto il metodo zap alle cache RW
Aggiunto i costruttori basati su file* per le cache generiche e delle statistiche git-svn-id: svn://10.65.10.50/trunk@5359 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4a0695a363
commit
466c5c81c8
@ -729,6 +729,14 @@ THash_object * TRWrecord_cache::get_some_obj()
|
||||
return o;
|
||||
}
|
||||
|
||||
TRWrecord_cache::TRWrecord_cache(TLocalisamfile *f, int key, bool lock)
|
||||
:TRecord_cache(f,key)
|
||||
{
|
||||
if (lock)
|
||||
file().lock();
|
||||
}
|
||||
|
||||
|
||||
TRWrecord_cache::TRWrecord_cache(int num, int key, bool lock)
|
||||
:TRecord_cache(num,key)
|
||||
{
|
||||
@ -736,6 +744,7 @@ TRWrecord_cache::TRWrecord_cache(int num, int key, bool lock)
|
||||
file().lock();
|
||||
}
|
||||
|
||||
|
||||
TRWrecord_cache::~TRWrecord_cache()
|
||||
{
|
||||
flush();
|
||||
@ -757,7 +766,21 @@ const TString & TStat_cache::getkey2discard()
|
||||
return o->key();
|
||||
}
|
||||
|
||||
TStat_cache ::TStat_cache (bool lock):
|
||||
TRWrecord_cache( LF_SVSTAT,1,lock)
|
||||
TStat_cache::TStat_cache (TLocalisamfile *f, bool lock):
|
||||
TRWrecord_cache( f,1,lock)
|
||||
{
|
||||
}
|
||||
|
||||
// azzera la cache e distrugge il file!
|
||||
void TStat_cache::zap()
|
||||
{
|
||||
clear();
|
||||
|
||||
int err=NOERR;
|
||||
while (err==NOERR)
|
||||
{
|
||||
err=file().first();
|
||||
if (err==NOERR)
|
||||
err=file().remove();
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
void clear();
|
||||
void flush();
|
||||
|
||||
TRWrecord_cache(TLocalisamfile *f, int key = 1, bool lock=FALSE);
|
||||
TRWrecord_cache(int num, int key = 1, bool lock=FALSE);
|
||||
TRWrecord_cache(const char* table, int key = 1, bool lock=FALSE);
|
||||
virtual ~TRWrecord_cache() ;
|
||||
@ -135,9 +136,11 @@ class TStat_cache : public TRWrecord_cache
|
||||
protected:
|
||||
virtual const TString & getkey2discard();
|
||||
public:
|
||||
TStat_cache (bool lock=FALSE);
|
||||
TStat_cache (TLocalisamfile &f, bool lock=FALSE);
|
||||
TStat_cache (TLocalisamfile *f, bool lock=FALSE);
|
||||
virtual ~TStat_cache()
|
||||
{}
|
||||
void zap();
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user