pike.git / lib / modules / Cache.pmod / Storage.pmod / Gdbm.pike

version» Context lines:

pike.git/lib/modules/Cache.pmod/Storage.pmod/Gdbm.pike:2:   //!   //! This storage manager provides the means to save data to memory.   //! In this manager I'll add reference documentation as comments to   //! interfaces. It will be organized later in a more comprehensive format   //!   //! Settings will be added later.   //!   //! @thanks   //! Thanks to Francesco Chemolli <kinkie@@roxen.com> for the contribution.    -  +    #pike __REAL_VERSION__ -  + #require constant(Gdbm.gdbm)      //after this many deletion ops, the databases will be compacted.   #define CLUTTERED 1000    - #if constant(Gdbm.gdbm) + inherit Cache.Storage.Base; +    Gdbm.gdbm db, metadb;   int deletion_ops=0; //every 1000 deletion ops, we'll reorganize.   int have_dependants=0;      //!   class Data {    inherit Cache.Data;       int _size=0;    string _key=0;
pike.git/lib/modules/Cache.pmod/Storage.pmod/Gdbm.pike:99: Inside #if constant(Gdbm.gdbm)
   werror("can't store value\n"); //TODO: use crumbs    return 0;    }    string tmp;    int tm=time(1);    mapping meta;    tmp=encode_value(value);    db[key]=tmp;    meta=(["size":sizeof(tmp),"atime":tm,"ctime":tm]);    if (expire_time) meta->etime=expire_time; -  if (preciousness||!zero_type(preciousness)) +  if (preciousness||!undefinedp(preciousness))    meta->cost=preciousness;    else    meta->cost=1.0;    if (dependants) {    meta->dependants=dependants;    have_dependants=1;    }       metadb[key]=encode_value(meta);   }
pike.git/lib/modules/Cache.pmod/Storage.pmod/Gdbm.pike:170: Inside #if constant(Gdbm.gdbm)
   deletion_ops=0;    }   }      //! A GDBM storage-manager must be hooked to a GDBM Database.   void create(string path) {    db=Gdbm.gdbm(path+".db","rwcf");    metadb=Gdbm.gdbm(path+"_meta.db","rwcf");   }    - #else - constant this_program_does_not_exist=1; - #endif // constant(Gdbm.gdbm) -  +    /**************** thoughts and miscellanea ******************/   //maybe we should split the database into two databases, one for the data   //and one for the metadata.      //we should really use an in-memory cache for the objects. I delay that   //for now, since we don't have a decent footprint-constrained policy   //manager yet.