From 9e1b9e73145e00ea591bd1e0e9777625bad66dc9 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Thu, 3 Jan 2013 07:41:14 +0000 Subject: Add support for HTTP patch and application of patch scripts to server and data store components. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428192 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/components/cache/datacache.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sca-cpp/trunk/components/cache/datacache.cpp') diff --git a/sca-cpp/trunk/components/cache/datacache.cpp b/sca-cpp/trunk/components/cache/datacache.cpp index 975ca43dce..4fafd9e345 100644 --- a/sca-cpp/trunk/components/cache/datacache.cpp +++ b/sca-cpp/trunk/components/cache/datacache.cpp @@ -94,6 +94,20 @@ const failable put(const value& key, const value& val, unused const lvvla return trueValue; } +/** + * Patch an item in the cache. + */ +const failable patch(const value& key, const value& val, unused const lvvlambda& rcache1, const lvvlambda& wcache1, unused const lvvlambda& rcache2, const lvvlambda& wcache2) { + + // Update level1 cache + wcache1(mklist("patch", key, val)); + + // Update level2 cache + wcache2(mklist("patch", key, val)); + + return trueValue; +} + /** * Delete an item from the cache. */ @@ -121,6 +135,8 @@ const tuscany::value apply(const tuscany::list& params) { return tuscany::datacache::post(cadr(params), caddr(params), cadddr(params), caddddr(params), cadddddr(params), caddddddr(params)); if (func == "put") return tuscany::datacache::put(cadr(params), caddr(params), cadddr(params), caddddr(params), cadddddr(params), caddddddr(params)); + if (func == "patch") + return tuscany::datacache::patch(cadr(params), caddr(params), cadddr(params), caddddr(params), cadddddr(params), caddddddr(params)); if (func == "delete") return tuscany::datacache::del(cadr(params), caddr(params), cadddr(params), caddddr(params), cadddddr(params)); return tuscany::mkfailure(); -- cgit v1.2.3