Class: MemcachedTest::Memcached_item
- Inherits:
-
Object
- Object
- MemcachedTest::Memcached_item
- Defined in:
- lib/memcached_test/memcached_item.rb
Instance Attribute Summary collapse
-
#bytes ⇒ Object
Returns the value of attribute bytes.
-
#cas ⇒ Object
Returns the value of attribute cas.
-
#data ⇒ Object
Returns the value of attribute data.
-
#exptime ⇒ Object
Returns the value of attribute exptime.
-
#flags ⇒ Object
Returns the value of attribute flags.
Instance Method Summary collapse
-
#initialize(flags, exptime, bytes, cas, data) ⇒ Memcached_item
constructor
A new instance of Memcached_item.
- #set_exptime(exptime) ⇒ Object
Constructor Details
#initialize(flags, exptime, bytes, cas, data) ⇒ Memcached_item
Returns a new instance of Memcached_item.
10 11 12 13 14 15 16 |
# File 'lib/memcached_test/memcached_item.rb', line 10 def initialize(flags, exptime, bytes, cas, data) @flags = flags @exptime = set_exptime(exptime) @bytes = bytes @cas = cas @data = data end |
Instance Attribute Details
#bytes ⇒ Object
Returns the value of attribute bytes.
6 7 8 |
# File 'lib/memcached_test/memcached_item.rb', line 6 def bytes @bytes end |
#cas ⇒ Object
Returns the value of attribute cas.
7 8 9 |
# File 'lib/memcached_test/memcached_item.rb', line 7 def cas @cas end |
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/memcached_test/memcached_item.rb', line 8 def data @data end |
#exptime ⇒ Object
Returns the value of attribute exptime.
5 6 7 |
# File 'lib/memcached_test/memcached_item.rb', line 5 def exptime @exptime end |
#flags ⇒ Object
Returns the value of attribute flags.
4 5 6 |
# File 'lib/memcached_test/memcached_item.rb', line 4 def flags @flags end |
Instance Method Details
#set_exptime(exptime) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/memcached_test/memcached_item.rb', line 18 def set_exptime(exptime) if exptime.to_i == 0 return nil elsif exptime.to_i < 2592000 return Time.now().getutc() + exptime.to_i else return Time.at(exptime.to_i) end end |