Sha256: 57f5bbf5999169c854c099b61ffb5ac241de37f9aa34782b287b7a956b010d65

Contents?: true

Size: 381 Bytes

Versions: 7

Compression:

Stored size: 381 Bytes

Contents

module Zemanta
  module Cache
    class Disk
      attr_accessor :db

      def initialize(directory='tmp/db')
        @db = Pathname.new(directory)
        @db.mkpath
      end

      def [](key)
        file = @db.join(key)
        file.read if file.exist?
      end

      def []=(key,value)
        @db.join(key).open('w') {|f| f.write(value.to_s)}
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zemanta_client-0.0.9 lib/zemanta/cache/disk.rb
zemanta_client-0.0.8 lib/zemanta/cache/disk.rb
zemanta_client-0.0.7 lib/zemanta/cache/disk.rb
zemanta_client-0.0.6 lib/zemanta/cache/disk.rb
zemanta_client-0.0.5 lib/zemanta/cache/disk.rb
zemanta_client-0.0.4 lib/zemanta/cache/disk.rb
zemanta_client-0.0.3 lib/zemanta/cache/disk.rb