This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/memcached.js b/lib/memcached.js | |
index c3e4f26..64a7a01 100644 | |
--- a/lib/memcached.js | |
+++ b/lib/memcached.js | |
@@ -78,7 +78,8 @@ Client.config = { | |
, BUFFER = 1E2 | |
, CONTINUE = 1E1 | |
, FLAG_JSON = 1<<1 | |
- , FLAG_BINARY = 2<<1; | |
+ , FLAG_BINARY = 2<<1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/memcached.js b/lib/memcached.js | |
index c3e4f26..64a7a01 100644 | |
--- a/lib/memcached.js | |
+++ b/lib/memcached.js | |
@@ -78,7 +78,8 @@ Client.config = { | |
, BUFFER = 1E2 | |
, CONTINUE = 1E1 | |
, FLAG_JSON = 1<<1 | |
- , FLAG_BINARY = 2<<1; | |
+ , FLAG_BINARY = 2<<1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/memcached.js b/lib/memcached.js | |
index c3e4f26..64a7a01 100644 | |
--- a/lib/memcached.js | |
+++ b/lib/memcached.js | |
@@ -78,7 +78,8 @@ Client.config = { | |
, BUFFER = 1E2 | |
, CONTINUE = 1E1 | |
, FLAG_JSON = 1<<1 | |
- , FLAG_BINARY = 2<<1; | |
+ , FLAG_BINARY = 2<<1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Buffer.isBuffer(value)){ | |
- flag = FLAG_BINARY; | |
+ if (compress) { | |
+ flag = FLAG_COMPRESSED; | |
+ value = new Buffer(zlib.deflate(value), 'binary'); | |
+ } else { | |
+ flag = FLAG_BINARY; | |
+ } | |
+ length = value.length; | |
value = value.toString('binary'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Buffer.isBuffer(value)){ | |
- flag = FLAG_BINARY; | |
+ if (compress) { | |
+ flag = FLAG_COMPRESSED; | |
+ value = new Buffer(zlib.deflate(value), 'binary'); | |
+ } else { | |
+ flag = FLAG_BINARY; | |
+ } | |
+ length = value.length; | |
value = value.toString('binary'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Buffer.isBuffer(value)){ | |
- flag = FLAG_BINARY; | |
+ if (compress) { | |
+ flag = FLAG_COMPRESSED; | |
+ value = new Buffer(zlib.deflate(value), 'binary'); | |
+ } else { | |
+ flag = FLAG_BINARY; | |
+ } | |
+ length = value.length; | |
value = value.toString('binary'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- private.setters = function setters(type, validate, key, value, lifetime, callback, cas){ | |
+ private.setters = function setters(type, validate, key, value, lifetime, compress, callback, cas){ | |
var flag = 0 | |
, memcached = this | |
, valuetype = typeof value | |
, length; | |
if (Buffer.isBuffer(value)){ | |
- flag = FLAG_BINARY; | |
+ if (compress) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from urllib import urlencode | |
from urllib2 import urlopen, Request | |
if sys.version_info[0] == 2 and sys.version_info[1] < 6: | |
import simplejson as json | |
else: | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from urllib import urlencode | |
from urllib2 import urlopen, Request | |
if sys.version_info[0] == 2 and sys.version_info[1] < 6: | |
import simplejson as json | |
else: | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from urllib import urlencode | |
from urllib2 import urlopen, Request | |
if sys.version_info[0] == 2 and sys.version_info[1] < 6: | |
import simplejson as json | |
else: | |
import json |
OlderNewer