Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyuan committed Aug 27, 2013
1 parent 644a91e commit cc21cbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -44,7 +44,7 @@ function getUser(id, cb) {
}

var user_id = 123;
var key = '#' + user_id; // for test if key is not the data (user_id) to load.
var key = '#' + user_id; // for test if key is not the parameter (user_id) to load.

// Using namespace "user"
var redisLoadBucket = redisStore.crateBucket('user', {
Expand All @@ -53,12 +53,13 @@ var redisLoadBucket = redisStore.crateBucket('user', {
// method to load a thing if it's not in the bucket.
load: function (user_id, cb) {
// this method will only be called if it's not already in bucket, and will
// bucket the result in the bucket store.
// store the result in the bucket store.
getUser(user_id, cb);
}
});

// `user_id` is used to load, or use `key` without `user_id` parameter.
// `user_id` is the parameter used to load.
// if no parameter is specified for loading, the `key` will be used.
redisLoadBucket.get(key, user_id, function (err, user) {
console.log(user);

Expand Down
9 changes: 5 additions & 4 deletions examples/example.js
Expand Up @@ -25,7 +25,7 @@ function getUser(id, cb) {
}

var user_id = 123;
var key = '#' + user_id; // for test if key is not the data (user_id) to load.
var key = '#' + user_id; // for test if key is not the parameter (user_id) to load.

// Using namespace "user"
var redisLoadBucket = redisStore.crateBucket('user', {
Expand All @@ -34,12 +34,13 @@ var redisLoadBucket = redisStore.crateBucket('user', {
// method to load a thing if it's not in the bucket.
load: function (user_id, cb) {
// this method will only be called if it's not already in bucket, and will
// bucket the result in the bucket store.
// store the result in the bucket store.
getUser(user_id, cb);
}
});

// `user_id` is used to load, or use `key` without `user_id` parameter.
// `user_id` is the parameter used to load.
// if no parameter is specified for loading, the `key` will be used.
redisLoadBucket.get(key, user_id, function (err, user) {
console.log(user);

Expand All @@ -52,4 +53,4 @@ redisLoadBucket.get(key, user_id, function (err, user) {
// Outputs:
// Returning user from slow database.
// { id: 123, name: 'Bob' }
// { id: 123, name: 'Bob' }
// { id: 123, name: 'Bob' }

0 comments on commit cc21cbd

Please sign in to comment.