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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Eddy (Guest)
on 2007-05-18 02: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 }

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

I'd expect to see:

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 => '',
  :readonly => false,
  :urlencode => false }

CACHE = memcache_options
CACHE.servers = 'localhost:11211')

Thanks in advance..
This topic is locked and can not be replied to.