diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-23 05:25:45 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-23 05:25:45 +0000 |
commit | e5d978186780787e8dad6681cca139486df93643 (patch) | |
tree | 85a837c0e230de4144743f090b2fe714cbb29fec /sca-cpp/trunk/kernel/cache.hpp | |
parent | 585f81b9436e137c3ed784d9a91efa9e6e792e03 (diff) |
Refactored memcached support into an SCA component. Moved cache monad functions to kernel.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@883250 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/kernel/cache.hpp (renamed from sca-cpp/trunk/modules/cache/cache.hpp) | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sca-cpp/trunk/modules/cache/cache.hpp b/sca-cpp/trunk/kernel/cache.hpp index ba66021f3d..28ab38c76f 100644 --- a/sca-cpp/trunk/modules/cache/cache.hpp +++ b/sca-cpp/trunk/kernel/cache.hpp @@ -23,7 +23,7 @@ #define tuscany_cache_hpp /** - * Simple cache monad implementation. + * Simple local cache monad implementation. */ #include <sys/stat.h> @@ -33,7 +33,6 @@ #include "monad.hpp" namespace tuscany { -namespace cache { /** * Cached monad. Used to represent a value that can be cached. @@ -53,10 +52,6 @@ public: cached(const cached<V>& c) : lvalue(c.lvalue), ltime(c.ltime), mtime(c.mtime), v(c.v) { } - operator const V() const { - return v; - } - const cached<V>& operator=(const cached<V>& c) { if(this == &c) return *this; @@ -84,6 +79,7 @@ private: V v; template<typename X> friend const cached<X> latest(const cached<X>& c); + template<typename X> friend const X content(const cached<X>& c); template<typename X> friend std::ostream& operator<<(std::ostream& out, const cached<X>& c); }; @@ -106,6 +102,13 @@ template<typename V> const cached<V> latest(const cached<V>& c) { } /** + * Returns the content of a cached monad. + */ +template<typename V> const V content(const cached<V>& c) { + return c.v; +} + +/** * Returns the latest modification time of a file. */ const unsigned long latestFileTime(const std::string& path) { @@ -117,6 +120,5 @@ const unsigned long latestFileTime(const std::string& path) { } } -} #endif /* tuscany_cache_hpp */ |