merge master

This commit is contained in:
Neil Lalonde
2016-03-31 17:33:25 -04:00
parent 95f2ac6535
commit 01d0aeb5a9
6404 changed files with 88070 additions and 62390 deletions
+4 -3
View File
@@ -3,6 +3,7 @@
# fill it up
require 'weakref'
require 'base64'
class DistributedCache
@subscribers = []
@@ -31,7 +32,7 @@ class DistributedCache
hash = current.hash(message.site_id)
case payload["op"]
when "set" then hash[payload["key"]] = payload["marshalled"] ? Marshal.load(payload["value"]) : payload["value"]
when "set" then hash[payload["key"]] = payload["marshalled"] ? Marshal.load(Base64.decode64(payload["value"])) : payload["value"]
when "delete" then hash.delete(payload["key"])
when "clear" then hash.clear
end
@@ -70,8 +71,8 @@ class DistributedCache
def self.set(hash, key, value)
# special support for set
marshal = Set === value
value = Marshal.dump(value) if marshal
marshal = (Set === value || Hash === value)
value = Base64.encode64(Marshal.dump(value)) if marshal
publish(hash, { op: :set, key: key, value: value, marshalled: marshal })
end