Class: Recents

Inherits:
Object
  • Object
show all
Defined in:
lib/pig-media-server/model/data.rb,
lib/pig-media-server/model/data_use_rdb.rb

Class Method Summary collapse

Class Method Details

.list(user) ⇒ Object



81
82
83
84
85
86
87
88
89
# File 'lib/pig-media-server/model/data.rb', line 81

def self.list user
  hash = {}
  Groonga['Recents'].select{|x|
    x._key =~ user
  }.to_a.map{|x| x._key.split("/").last}.each{|x|
    hash["movie/#{x}"] = {}
  }
  hash
end

.recent(user, key) ⇒ Object



98
99
100
101
# File 'lib/pig-media-server/model/data.rb', line 98

def self.recent user, key
  key =user+'/'+key
  Groonga['Recents'].add key
end

.recent?(user, key) ⇒ Boolean

Returns:

  • (Boolean)


91
92
93
94
95
96
# File 'lib/pig-media-server/model/data.rb', line 91

def self.recent? user, key
  key =user+'/'+key
  !!Groonga['Recents'][key]
rescue
  nil
end