lib/openwfe/expool/expstorage.rb in openwferu-0.9.2 vs lib/openwfe/expool/expstorage.rb in openwferu-0.9.3
- old
+ new
@@ -69,22 +69,24 @@
@persistence = @application_context[:file_expression_storage]
end
#
# call the add method for each registered storage
+ #
def []= (fei, flowExpression)
@journal[fei] = flowExpression if @journal
@cache[fei] = flowExpression if @cache
@persistence[fei] = flowExpression
end
#
# remove the expressionid from each registered storage
- def remove (fei, workitem)
- @journal.remove(fei, workitem) if @journal
- @cache.remove(fei, workitem) if @cache
- @persistence.remove(fei,workitem)
+ #
+ def delete (fei)
+ @journal.delete(fei) if @journal
+ @cache.delete(fei) if @cache
+ @persistence.delete(fei)
end
#
# slightly different method. Try to get the value from the cache storage if one
# if not retrieve it, and then add it to the cache.
@@ -117,11 +119,12 @@
@cache[fei]=flowExpression
end
#
# interface method to remove an entry for the given expression_id
- def remove (fei, workitem)
+ #
+ def delete (fei)
@cache.delete(fei)
end
#
# check if the value is in the cache
@@ -149,19 +152,16 @@
#
class InMemoryExpressionStorage < Hash
include ServiceMixin
def initialize (service_name, application_context)
- @service_name = service_name
- @application_context = application_context
+ service_init(service_name, application_context)
end
- def remove (fei, workitem)
- delete(fei)
- end
+ alias :purge :clear
- def purge
- self.clear
+ def each_of_kind (kind)
+ # TODO : implement with a filter
end
def to_s
s = "\n\n==== #{self.class} ===="
each do |k, v|