Sha256: 42d0f63c6f66f25d156e951f8e12822164f84f531cf4ed0657e452d8466971a4
Contents?: true
Size: 933 Bytes
Versions: 23
Compression:
Stored size: 933 Bytes
Contents
require 'zygote/memory' # An entry into the queue class CellQueueEntry < SuperModel::Base include SuperModel::Marshal::Model end # A means of storing Cell queue data for a given sku module CellQueue extend self COLLECTION = :assets ARRAY_KEY = :cell_queue Memory.load def push(key, data) entry = CellQueueEntry.find_by_name(key) unless entry entry = CellQueueEntry.new(name: key, data: []) entry.save end entry.data << data entry.save Memory.save end def shift(key) entry = CellQueueEntry.find_by_name(key) return nil unless entry first = entry.data.shift entry.save Memory.save first end def show(key) entry = CellQueueEntry.find_by_name(key) entry ? entry.data : [] end def purge(key) entry = CellQueueEntry.find_by_name(key) entry.data = [] if entry entry.save if entry end def all CellQueueEntry.all end end
Version data entries
23 entries across 23 versions & 1 rubygems