diff options
Diffstat (limited to 'sca-cpp/trunk/components/cache')
-rw-r--r-- | sca-cpp/trunk/components/cache/memcache-test.cpp | 6 | ||||
-rw-r--r-- | sca-cpp/trunk/components/cache/memcache.cpp | 26 | ||||
-rw-r--r-- | sca-cpp/trunk/components/cache/memcache.hpp | 22 |
3 files changed, 27 insertions, 27 deletions
diff --git a/sca-cpp/trunk/components/cache/memcache-test.cpp b/sca-cpp/trunk/components/cache/memcache-test.cpp index bc590fa047..ea9e9883dc 100644 --- a/sca-cpp/trunk/components/cache/memcache-test.cpp +++ b/sca-cpp/trunk/components/cache/memcache-test.cpp @@ -30,7 +30,7 @@ #include "memcache.hpp" namespace tuscany { -namespace cache { +namespace memcache { bool testMemCached() { MemCached ch("127.0.0.1", 11211); @@ -73,8 +73,8 @@ bool testGetPerf() { int main() { tuscany::cout << "Testing..." << tuscany::endl; - tuscany::cache::testMemCached(); - tuscany::cache::testGetPerf(); + tuscany::memcache::testMemCached(); + tuscany::memcache::testGetPerf(); tuscany::cout << "OK" << tuscany::endl; diff --git a/sca-cpp/trunk/components/cache/memcache.cpp b/sca-cpp/trunk/components/cache/memcache.cpp index 304975614e..247e38d517 100644 --- a/sca-cpp/trunk/components/cache/memcache.cpp +++ b/sca-cpp/trunk/components/cache/memcache.cpp @@ -34,13 +34,13 @@ #include "memcache.hpp" namespace tuscany { -namespace memcache { +namespace cache { /** * Get an item from the cache. */ -const failable<value> get(const list<value>& params, cache::MemCached& ch) { - return cache::get(car(params), ch); +const failable<value> get(const list<value>& params, memcache::MemCached& ch) { + return memcache::get(car(params), ch); } /** @@ -54,9 +54,9 @@ const value uuidValue() { return value(string(buf, APR_UUID_FORMATTED_LENGTH)); } -const failable<value> post(const list<value>& params, cache::MemCached& ch) { +const failable<value> post(const list<value>& params, memcache::MemCached& ch) { const value id = append<value>(car(params), mklist(uuidValue())); - const failable<bool> val = cache::post(id, cadr(params), ch); + const failable<bool> val = memcache::post(id, cadr(params), ch); if (!hasContent(val)) return mkfailure<value>(reason(val)); return id; @@ -65,8 +65,8 @@ const failable<value> post(const list<value>& params, cache::MemCached& ch) { /** * Put an item into the cache. */ -const failable<value> put(const list<value>& params, cache::MemCached& ch) { - const failable<bool> val = cache::put(car(params), cadr(params), ch); +const failable<value> put(const list<value>& params, memcache::MemCached& ch) { + const failable<bool> val = memcache::put(car(params), cadr(params), ch); if (!hasContent(val)) return mkfailure<value>(reason(val)); return value(content(val)); @@ -75,8 +75,8 @@ const failable<value> put(const list<value>& params, cache::MemCached& ch) { /** * Delete an item from the cache. */ -const failable<value> del(const list<value>& params, cache::MemCached& ch) { - const failable<bool> val = cache::del(car(params), ch); +const failable<value> del(const list<value>& params, memcache::MemCached& ch) { + const failable<bool> val = memcache::del(car(params), ch); if (!hasContent(val)) return mkfailure<value>(reason(val)); return value(content(val)); @@ -87,7 +87,7 @@ const failable<value> del(const list<value>& params, cache::MemCached& ch) { */ class applyCache { public: - applyCache(cache::MemCached& ch) : ch(ch) { + applyCache(memcache::MemCached& ch) : ch(ch) { } const value operator()(const list<value>& params) const { @@ -104,7 +104,7 @@ public: } private: - cache::MemCached& ch; + memcache::MemCached& ch; }; /** @@ -112,7 +112,7 @@ private: */ const failable<value> start(unused const list<value>& params) { // Connect to memcached - cache::MemCached& ch = *(new (gc_new<cache::MemCached>()) cache::MemCached("127.0.0.1", 11211)); + memcache::MemCached& ch = *(new (gc_new<memcache::MemCached>()) memcache::MemCached("127.0.0.1", 11211)); // Return the component implementation lambda function return value(lambda<value(const list<value>&)>(applyCache(ch))); @@ -126,7 +126,7 @@ extern "C" { const tuscany::value apply(const tuscany::list<tuscany::value>& params) { const tuscany::value func(car(params)); if (func == "start") - return tuscany::memcache::start(cdr(params)); + return tuscany::cache::start(cdr(params)); return tuscany::mkfailure<tuscany::value>(); } diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp index c630f6fd55..d410b90767 100644 --- a/sca-cpp/trunk/components/cache/memcache.hpp +++ b/sca-cpp/trunk/components/cache/memcache.hpp @@ -41,7 +41,7 @@ #include "../../modules/scheme/eval.hpp" namespace tuscany { -namespace cache { +namespace memcache { /** * Represents a memcached context. @@ -97,8 +97,8 @@ private: * Post a new item to the cache. */ const failable<bool> post(const value& key, const value& val, const MemCached& cache) { - debug(key, "cache::post::key"); - debug(val, "cache::post::value"); + debug(key, "memcache::post::key"); + debug(val, "memcache::post::value"); const string ks(scheme::writeValue(key)); const string vs(scheme::writeValue(val)); @@ -106,7 +106,7 @@ const failable<bool> post(const value& key, const value& val, const MemCached& c if (rc != APR_SUCCESS) return mkfailure<bool>("Could not add entry"); - debug(true, "cache::post::result"); + debug(true, "memcache::post::result"); return true; } @@ -114,8 +114,8 @@ const failable<bool> post(const value& key, const value& val, const MemCached& c * Update an item in the cache. If the item doesn't exist it is added. */ const failable<bool> put(const value& key, const value& val, const MemCached& cache) { - debug(key, "cache::put::key"); - debug(val, "cache::put::value"); + debug(key, "memcache::put::key"); + debug(val, "memcache::put::value"); const string ks(scheme::writeValue(key)); const string vs(scheme::writeValue(val)); @@ -123,7 +123,7 @@ const failable<bool> put(const value& key, const value& val, const MemCached& ca if (rc != APR_SUCCESS) return mkfailure<bool>("Could not set entry"); - debug(true, "cache::put::result"); + debug(true, "memcache::put::result"); return true; } @@ -131,7 +131,7 @@ const failable<bool> put(const value& key, const value& val, const MemCached& ca * Get an item from the cache. */ const failable<value> get(const value& key, const MemCached& cache) { - debug(key, "cache::get::key"); + debug(key, "memcache::get::key"); const string ks(scheme::writeValue(key)); apr_pool_t* vpool; @@ -150,7 +150,7 @@ const failable<value> get(const value& key, const MemCached& cache) { const value val(scheme::readValue(string(data, size))); apr_pool_destroy(vpool); - debug(val, "cache::get::result"); + debug(val, "memcache::get::result"); return val; } @@ -158,14 +158,14 @@ const failable<value> get(const value& key, const MemCached& cache) { * Delete an item from the cache */ const failable<bool> del(const value& key, const MemCached& cache) { - debug(key, "cache::delete::key"); + debug(key, "memcache::delete::key"); const string ks(scheme::writeValue(key)); const apr_status_t rc = apr_memcache_delete(cache.mc, c_str(ks), 0); if (rc != APR_SUCCESS) return mkfailure<bool>("Could not delete entry"); - debug(true, "cache::delete::result"); + debug(true, "memcache::delete::result"); return true; } |