Sha256: f56b83c17939a0c290f2b86bd82dd959b966af950e6d564fa7e0cf88d61a18c9

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

class LocalFileStoreApp
  
  class AppFileStore
    # writeDelay in seconds, default is 30 seconds
    def initialize(store,appClass,instanceName)
      @store=store
      @appClass=appClass
      @instanceName=instanceName
    end
    
    def []=(name,value)
      save(name,value)
    end
    def [](name)
      load(name)
    end
    def rm(name)
      @store.getApp(:permaspace).rm(id(name))
    end

    private
    def save(name,value)
      @store.getApp(:permaspace).store(id(name),value)
    end
    def load(name)
      @store.getApp(:permaspace).load(id(name))
    end
    def id(name)
      "AFS_#{@appClass}_#{@instanceName}_#{name}".gsub(/[^a-zA-Z0-9_]/,'')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/local_file_store/app_file_store.rb