Class: ManabuDesktop::Util::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/util/cache.rb

Constant Summary collapse

@@cache_path_override =
nil

Class Method Summary collapse

Class Method Details

.cache_pathObject



18
19
20
# File 'lib/util/cache.rb', line 18

def self.cache_path()
  @@cache_path_override || ENV['MANABU_DESKTOP_CACHE'] || "#{ENV['HOME']}/.manabu-desktop/"
end

.load(file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/util/cache.rb', line 6

def self.load(file)
  if File.exist?("#{cache_path()}/login_cache.msgpack")
    file = File.open("#{cache_path()}/login_cache.msgpack", 'rb')
    content = file.read()
    begin
      return MessagePack.unpack(content)
    rescue
    end          
  end
  {}
end