Annotation of parser3/src/types/pa_vmemcached.h, revision 1.14
1.1 moko 1: /** @file
2: Parser: memcached class decls.
3:
1.13 moko 4: Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.1 moko 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.14 ! moko 13: #define IDENT_PA_VMEMCACHED_H "$Id: pa_vmemcached.h,v 1.13 2026/04/25 13:38:46 moko Exp $"
1.1 moko 14:
15: #include "classes.h"
16: #include "pa_vstateless_object.h"
1.14 ! moko 17: #include "pa_pool.h"
1.1 moko 18:
19: #include "pa_memcached.h"
20:
21: // defines
22: #define VMEMCACHED_TYPE "memcached"
23:
24: // externs
25: extern Methoded *memcached_class;
26:
1.14 ! moko 27: class VMemcached: public VStateless_object, Pooled {
1.1 moko 28: public:
29: override const char* type() const { return VMEMCACHED_TYPE; }
30: override VStateless_class *get_class() { return memcached_class; }
31: override bool as_bool() const { return true; }
32:
33: override Value* get_element(const String& aname);
1.6 moko 34: override const VJunction* put_element(const String& aname, Value* avalue);
1.1 moko 35:
36: public: // usage
1.14 ! moko 37: VMemcached(Pool& apool): Pooled(apool), fm(0), fttl(0) {}
1.1 moko 38:
1.14 ! moko 39: /// called by the request pool at the end of the request
! 40: override ~VMemcached(){
1.1 moko 41: if(fm)
42: f_memcached_free(fm);
43: }
44:
1.7 moko 45: void open(const String& options_string, time_t attl, bool connect);
1.3 moko 46: void open_parse(const String& connect_string, time_t attl);
47:
1.4 moko 48: bool add(const String& aname, Value* avalue);
1.1 moko 49: void remove(const String& aname);
1.2 moko 50: void flush(time_t attl=0);
1.5 moko 51: void quit();
1.2 moko 52: Value &mget(ArrayString &akeys);
1.1 moko 53:
54: private:
55: memcached_st* fm;
1.2 moko 56: time_t fttl;
1.1 moko 57:
58: };
59:
60: #endif
61:
E-mail: