Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

JSON Special fields

1 reply [Last post]
  • Login or register to post comments
Thu, 03/08/2012 - 02:00
trurl
Offline
Joined: 02/21/2012
Groups: None

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
                    }
                }
            }
        }
    ]
}

Top
  • Login or register to post comments
Thu, 03/08/2012 - 02:21
trurl
Offline
Joined: 02/21/2012
Groups: None

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

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker