Annotation of parser3/src/types/pa_vmemcached.h, revision 1.4

1.1       moko        1: /** @file
                      2:        Parser: memcached class decls.
                      3: 
                      4:        Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com)
                      5:        Authors:
                      6:                Ivan Poluyanov <ivan-poluyanov@yandex.ru>
                      7:                Artem Stepanov <timofei1394@thesecure.in>
                      8: */
                      9: 
                     10: #ifndef PA_VMEMCACHED_H
                     11: #define PA_VMEMCACHED_H
                     12: 
1.4     ! moko       13: #define IDENT_PA_VMEMCACHED_H "$Id: pa_vmemcached.h,v 1.3 2012-04-22 22:06:50 moko Exp $"
1.1       moko       14: 
                     15: #include "classes.h"
                     16: #include "pa_vstateless_object.h"
                     17: 
                     18: #include "pa_memcached.h"
                     19: 
                     20: // defines
                     21: #define VMEMCACHED_TYPE "memcached"
                     22: 
                     23: // externs
                     24: extern Methoded *memcached_class;
                     25: 
                     26: class VMemcached: public VStateless_object {
                     27: public:
                     28:        override const char* type() const { return VMEMCACHED_TYPE; }
                     29:        override VStateless_class *get_class() { return memcached_class; }
                     30:        override bool as_bool() const { return true; }
                     31: 
                     32:        override Value* get_element(const String& aname);
                     33:        override const VJunction* put_element(const String& aname, Value* avalue, bool /*replace*/);
                     34: 
                     35: public: // usage
1.2       moko       36:        VMemcached(): fm(0), fttl(0) {}
1.1       moko       37: 
                     38:        ~VMemcached(){
                     39:                if(fm)
                     40:                        f_memcached_free(fm);
                     41:        }
                     42: 
1.3       moko       43:        void open(const String& options_string, time_t attl);
                     44:        void open_parse(const String& connect_string, time_t attl);
                     45:        
1.4     ! moko       46:        bool add(const String& aname, Value* avalue);
1.1       moko       47:        void remove(const String& aname);
1.2       moko       48:        void flush(time_t attl=0);
                     49:        Value &mget(ArrayString &akeys);
1.1       moko       50: 
                     51: private:
                     52:        memcached_st* fm;
1.2       moko       53:        time_t fttl;
1.1       moko       54: 
                     55: };
                     56: 
                     57: #endif
                     58: 

E-mail: