Add following to rails_worker_proxy.rb file:
diff --git a/lib/backgroundrb/rails_worker_proxy.rb
b/lib/backgroundrb/rails_worker_proxy.rb
index 0205f07..2b0a080 100644
--- a/lib/backgroundrb/rails_worker_proxy.rb
+++ b/lib/backgroundrb/rails_worker_proxy.rb
@@ -105,6 +105,13 @@ module BackgrounDRb
middle_man.cache[gen_key(options)]
end
+ def reset_memcache_result(job_key,value)
+ options = compact(:worker => worker_name,:worker_key =>
worker_key,:job_key => job_key)
+ key = gen_key(options)
+ middle_man.cache[key] = value
+ value
+ end
+
def return_result result
result = Array(result)
result.size <= 1 ? result[0] : result
And use it with:
MiddleMan.worker(:foo_worker).reset_memcache_result("key",value)
It will be checked in soonish (need to write testcases and stuff)
On Wed, 2008-09-24 at 11:29 -0400, Mitchell Curtis Hatter
wrote:> I''m trying to figure out how to clear the for a worker from my
> controller.
>
> In my aysnc_xxx process I set cache[key]. However, I don''t see an
easy
> way to clear the cache from a controller with invoking something on
> the worker.
>
> What I was looking for was something like
>
> MiddleMan(:worker_name, :worker_key_name).cache[key]>
> Is there something like that and I''m just missing it or do I need
to
> create a "clear_cache" function on my worker and call that when I
need
> to clear the cache?
>
> Thanks,
> Curtis
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel