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

Php: Groups of keys

10 replies [Last post]
  • Login or register to post comments
Fri, 07/22/2011 - 08:30
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

Memcached supports a key/value pair system.

Is there a way to group keys together? And return all the keys within a group.

I don't need the items in the group to lock. I just need to get a list of keys.

I can keep a list of keys in a key/value pair. But in that case I might drop a key during a write.

It would be better to have this kind of logic built-in.

Alternatively, I could always use a prefix on key names. Is there a search feature to return keys matching a prefix?

Thanks

Top
  • Login or register to post comments
Fri, 07/22/2011 - 08:40
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

I see there's a concept of buckets, but I really didn't expect needing a whole new port to group key/value pairs.
http://www.couchbase.org/wiki/display/membase/Data+partitioning+with+buc...

Is there a way to create buckets from php? Or anytime you need a bucket do you need to use the web admin panel? Or is the panel not capable of creating a bucket?

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:01
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

The Membase console supports creating buckets under the Manage->Data Buckets section.

I created two Memcached SASL buckets. How does the php Memcache::get and Memcache::set methods specify the bucket name?

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:05
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

Memcache get and set don't specify the bucket. Do you have a special client that specifies the bucket name?
http://www.php.net/manual/en/memcache.get.php

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:08
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

I've put the buckets on their own ports so I can use a separate connection to access each bucket.

Seems like I'm wasting connections.

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:10
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

I have a bucket ONLINE_USERS, how do I query all the keys in that bucket?

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:14
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

I obviously want to use the memcached client which can at least retrieve values from a list of keys rather than a separate call for each one:
http://www.php.net/manual/en/memcached.getmulti.php

Top
  • Login or register to post comments
Fri, 07/22/2011 - 09:31
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

Querying for all the keys in a bucket is not a scalable operation and would introduce locking. So an alternative would be to paginate the list of database users and query if each user key is online in a paginated way.

This would be slower but performance shouldn't be an issue in offline analysis.

Still it would be nice to dump the key/values to disk for faster analysis.

Top
  • Login or register to post comments
Mon, 07/25/2011 - 15:09
perry
Offline
Joined: 10/11/2010
Groups:

Looks like you've answered a lot of your own questions, I'll just fill in the last bit.

With the current software, you can use the TAP interface (http://www.couchbase.org/wiki/display/membase/TAP+Protocol) to get a stream of keys and values from a Membase server in a non-performance-impacting way.

I would also suggest taking a look at this post on maintaining a set/index within Membase: http://dustin.github.com/2011/02/17/memcached-set.html

Lastly, our 2.0 product will provide an even easier way to retrieve a list of keys by allowing you to map-reduce and index.

Perry

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

Top
  • Login or register to post comments
Thu, 08/04/2011 - 17:54
tgraupmann
Offline
Joined: 07/21/2011
Groups: None

Is there a Windows php extension for the TAP protocol?

Top
  • Login or register to post comments
Fri, 08/05/2011 - 11:32
perry
Offline
Joined: 10/11/2010
Groups:

Not yet unfortunately.

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

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