diff options
Diffstat (limited to 'project2/json')
-rw-r--r-- | project2/json/couchSession.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/project2/json/couchSession.cpp b/project2/json/couchSession.cpp index ab7a7be..b4b3f6b 100644 --- a/project2/json/couchSession.cpp +++ b/project2/json/couchSession.cpp @@ -110,27 +110,12 @@ const Glib::ustring CouchSessionContainer::ExpiryKey("project2:expires"); class CustomCouchSessionLoader : public SessionContainerLoader::For<CouchSessionContainer> { public: - CustomCouchSessionLoader() : - opts("Session CouchDB options") - { - opts - ("session.couchdb.baseUrl", Options::functions( - [](const VariableType & v) { CouchSessionContainer::baseUrls.push_back(v); }, - boost::bind(&std::vector<std::string>::clear, &CouchSessionContainer::baseUrls)), - "Base URL to store sessions in") - ; - } - const Options * - options() const - { - return &opts; - } - void onPeriodic() { deleteSessions(); compactDB(); } + INITOPTIONS; private: static size_t discard(size_t l) { return l; @@ -188,7 +173,11 @@ class CustomCouchSessionLoader : public SessionContainerLoader::For<CouchSession return; } } - Options opts; }; DECLARE_CUSTOM_COMPONENT_LOADER("couchsession", CouchSessionContainer, CustomCouchSessionLoader, SessionContainerLoader); +DECLARE_OPTIONS(CustomCouchSessionLoader, "Session CouchDB options") +("session.couchdb.baseUrl", Options::functions([](const VariableType & v) { CouchSessionContainer::baseUrls.push_back(v); }, boost::bind(&std::vector<std::string>::clear, &CouchSessionContainer::baseUrls)), + "Base URL to store sessions in") +END_OPTIONS(CustomCouchSessionLoader); + |