Trying to great MemCached like a SESSION array


#1

hi. can someone help in what i’m doing wrong?

i just want to treat this CACHE as if it were a session / variable that
was an array.

def test
CACHE[:test] = []
an_array = %w{ foo bar baz}
an_array.each { |i| CACHE[:test] << i }
end

Now in Views, when i simply pull out of the array:
<% CACHE[:test].each do |i| %>
<%= i %>

<%end %>

I’d expect to see:
foo
bar
baz

My cache is up and running. What am i doing wrong?

(My environment.rb for the cache is standard:
require ‘memcache’

memcache_options = {
:c_threshold => 10_000,
:compression => true,
:debug => false,
:namespace => ‘pazap.com’,
:readonly => false,
:urlencode => false }

CACHE = MemCache.new memcache_options
CACHE.servers = ‘localhost:11211’)

Thanks in advance…