Forum: Ruby on Rails Trying to great MemCached like a SESSION array..

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
224b787861d66cc06fa539df14672763?d=identicon&s=25 Eddy (Guest)
on 2007-05-18 00:29
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 %> <br>
<%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..
This topic is locked and can not be replied to.