Class: Kvom::Storage::S3Storage

Inherits:
Base
  • Object
show all
Defined in:
lib/kvom/storage/s3_storage.rb

Defined Under Namespace

Modules: CacheAware

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#get, #put

Constructor Details

#initialize(options) ⇒ S3Storage

Returns a new instance of S3Storage.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kvom/storage/s3_storage.rb', line 9

def initialize(options)
  super
  @bucket = config[:bucket] or raise "No bucket specified"
  if "" != (bucket_prefix = config[:bucket_prefix].to_s)
    @bucket_prefix = bucket_prefix
  end

  if (cache = config[:cache])
    cache_prefix = config[:cache_prefix].to_s
    @cache =
        if "" != cache_prefix
          CacheWithPrefix.new(cache, cache_prefix)
        else
          cache
        end
    extend S3Storage::CacheAware
  end
end