Sha256: 06de0f82be87f4300390ca683a226e3d02a878cfeeb6969c1a269ca1328174a5

Contents?: true

Size: 581 Bytes

Versions: 14

Compression:

Stored size: 581 Bytes

Contents

require 'aws-sdk'

module Alephant
  class Cache
    attr_reader :id, :bucket, :path

    def initialize(id, path)
      @logger = ::Alephant.logger
      @id = id
      @path = path

      s3 = AWS::S3.new
      @bucket = s3.buckets[id]
      @logger.info("Cache.initialize: end with id #{id} and path #{path}")
    end

    def put(id, data)
      @bucket.objects["#{@path}/#{id}"].write(data)
      @logger.info("Cache.put: #{@path}/#{id}")
    end

    def get(id)
      @logger.info("Cache.get: #{@path}/#{id}")
      @bucket.objects["#{@path}/#{id}"].read
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
alephant-0.0.9.9.1-java lib/alephant/models/cache.rb
alephant-0.0.9.9-java lib/alephant/models/cache.rb
alephant-0.0.9.8-java lib/alephant/models/cache.rb
alephant-0.0.9.7-java lib/alephant/models/cache.rb
alephant-0.0.9.6-java lib/alephant/models/cache.rb
alephant-0.0.9.5-java lib/alephant/models/cache.rb
alephant-0.0.9.4-java lib/alephant/models/cache.rb
alephant-0.0.9.3-java lib/alephant/models/cache.rb
alephant-0.0.9.2-java lib/alephant/models/cache.rb
alephant-0.0.9.1-java lib/alephant/models/cache.rb
alephant-0.0.9-java lib/alephant/models/cache.rb
alephant-0.0.8.2-java lib/alephant/models/cache.rb
alephant-0.0.8.1-java lib/alephant/models/cache.rb
alephant-0.0.8-java lib/alephant/models/cache.rb