class WirisPlugin::FolderTreeStorageAndCache
Attributes
cache[RW]
cacheFormula[RW]
config[RW]
Public Class Methods
backwards_compat()
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 13 def self.backwards_compat @@backwards_compat end
backwards_compat=(backwards_compat)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 16 def self.backwards_compat=(backwards_compat) @@backwards_compat = backwards_compat end
new()
click to toggle source
Calls superclass method
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 21 def initialize() super() end
Public Instance Methods
codeDigest(content)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 29 def codeDigest(content) digest = Md5Tools::encodeString(content) begin self.cacheFormula::set(digest + ".ini",Bytes::ofData(Utf8::toBytes(content))) end return digest end
decodeDigest(digest)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 36 def decodeDigest(digest) data = self.cacheFormula::get(digest + ".ini") if data != nil return Utf8::fromBytes(data::getData()) else return nil end end
deleteCache()
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 66 def deleteCache() cache = CacheImpl.new(self.config) begin cache::deleteAll() end end
getExtension(service)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 57 def getExtension(service) if (service == "png") return "png" end if (service == "svg") return "svg" end return service + ".txt" end
init(obj, config, cache, cacheFormula)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 24 def init(obj, config, cache, cacheFormula) self.config = config self.cache = cache self.cacheFormula = cacheFormula end
retreiveData(digest, service)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 44 def retreiveData(digest, service) data = self.cache::get((digest + ".") + getExtension(service)) if data != nil return data::getData() else return nil end end
storeData(digest, service, stream)
click to toggle source
# File lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb, line 52 def storeData(digest, service, stream) begin self.cache::set((digest + ".") + self.getExtension(service),Bytes::ofData(stream)) end end