JSON Special fields
Thu, 03/08/2012 - 02:00
May be better to add protection for special fields or just enable to use it directly?
generating object:
$memcache_obj = new Memcache; $memcache_obj->addServer("localhost", 11211); $obb['title']="Winnie-the-Pooh"; $obb['isbn']=array("978-5-17-066600-3","978-5-271-27610-1","978-985-16-8371-6"); $obb['$expiration']=10; $memcache_obj->set("my_key3",json_encode($obb),0,3600);
checking /couchBase/default/my_key3
{
"_id": "my_key3",
"_rev": "6-000010ec1e217d1b0000007100000000",
"title": "Winnie-the-Pooh",
"isbn": [
"978-5-17-066600-3",
"978-5-271-27610-1",
"978-985-16-8371-6"
],
"$expiration": 10
}checking /couchBase/default/_all_docs?include_docs=true
{
"total_rows": 1,
"rows": [
{
"id": "my_key3",
"key": "my_key3",
"value": {
"rev": "6-000010ec1e217d1b0000007100000000"
},
"doc": {
"_id": "my_key3",
"_rev": "6-000010ec1e217d1b0000007100000000",
"$flags": 0,
"$expiration": 1331200414,
"$att_reason": "invalid_key",
"_attachments": {
"value": {
"content_type": "application/content-stream",
"revpos": 7,
"digest": "md5-U20JlQUGaVm111451yZo2w==",
"length": 113,
"stub": true
}
}
}
}
]
}
Also will be usefull add special fields like $cachecontrol or $cache-directive + $cache-request-directive + $cache-response-directive + $cache-extension
And start use it in REST ;)
Including using $expiration as "Expires=Thu, 08 Mar 2012 09:40:01 GMT" in header