tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r931800 - in /tuscany/sca-cpp/trunk/components/cache: memcache-test.cpp memcache.cpp memcache.hpp
Date Thu, 08 Apr 2010 07:17:42 GMT
Author: jsdelfino
Date: Thu Apr  8 07:17:42 2010
New Revision: 931800

URL: http://svn.apache.org/viewvc?rev=931800&view=rev
Log:
Minor fix, cleanup namespace.

Modified:
    tuscany/sca-cpp/trunk/components/cache/memcache-test.cpp
    tuscany/sca-cpp/trunk/components/cache/memcache.cpp
    tuscany/sca-cpp/trunk/components/cache/memcache.hpp

Modified: tuscany/sca-cpp/trunk/components/cache/memcache-test.cpp
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/components/cache/memcache-test.cpp?rev=931800&r1=931799&r2=931800&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/components/cache/memcache-test.cpp (original)
+++ tuscany/sca-cpp/trunk/components/cache/memcache-test.cpp Thu Apr  8 07:17:42 2010
@@ -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;
 

Modified: tuscany/sca-cpp/trunk/components/cache/memcache.cpp
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/components/cache/memcache.cpp?rev=931800&r1=931799&r2=931800&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/components/cache/memcache.cpp (original)
+++ tuscany/sca-cpp/trunk/components/cache/memcache.cpp Thu Apr  8 07:17:42 2010
@@ -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<va
 /**
  * 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<val
 /**
  * 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<val
  */
 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>();
 }
 

Modified: tuscany/sca-cpp/trunk/components/cache/memcache.hpp
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/components/cache/memcache.hpp?rev=931800&r1=931799&r2=931800&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/components/cache/memcache.hpp (original)
+++ tuscany/sca-cpp/trunk/components/cache/memcache.hpp Thu Apr  8 07:17:42 2010
@@ -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& k
     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& k
  * 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& ke
     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& ke
  * 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& k
     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& k
  * 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;
 }
 



Mime
View raw message