Sha256: bd5ae5904f052937eb1a2d316d63d0ca417c590d987e792a8f46124349fc547e

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

require 'alephant/cache/version'
require 'alephant/logger'
require 'aws-sdk'

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

    def initialize(id, path)
      @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

2 entries across 2 versions & 1 rubygems

Version Path
alephant-cache-0.0.2 lib/alephant/cache.rb
alephant-cache-0.0.1 lib/alephant/cache.rb