unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Clifton King <cliftonk@gmail.com>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Memcache reset on rails 2.3 with preload
Date: Thu, 10 Mar 2011 14:48:22 -0600	[thread overview]
Message-ID: <AANLkTik_90ERYfZgQp0PSWZ6DQE54jQvtWjqZbL+2-ZS@mail.gmail.com> (raw)
In-Reply-To: <4D790788.8010305@mrtech.ru>

I opt to use this gem: https://github.com/fauna/memcached

I use the following settings in my environment:

  $memcached         = Memcached::Rails.new(cache_server,
                                            :namespace       => "os-",
                                            :tcp_nodelay     => true,
  # disable nagle algorithm
                                            :no_block        => true)
  # dont block on writes

ActionController::Base.cache_store                = :mem_cache_store, $memcached
  $session_memcached = Memcached::Rails.new(cache_server,
                                            :namespace       => "os-",
                                            :tcp_nodelay     => true,
  # disable nagle algorithm
                                            :no_block        => true)
  ActionController::Base.cache_store                =
:mem_cache_store, $memcached
  ActionController::Base.session_store              = :mem_cache_store
  ActionController::Base.session_options[:cache]    = $session_memcached


in after_fork i have

$memcached.reset
$session_memcached.reset


Clifton

On Thu, Mar 10, 2011 at 11:16 AM, Troex Nevelin <list@mrtech.ru> wrote:
> What is a right code for resetting memcache connection in after_fork for
> Rails 2.3 with "preload_app true" on REE?
>
> The only configurations about memcache in my app are:
>
> config/initializers/session_store.rb:
> ActionController::Base.session_store = :mem_cache_store
>
> config/environment.rb:
> config.cache_store = :mem_cache_store
>
>
> I tried:
> Rails.cache.reset
>
> But it fails to start, looks like this code is for Rails3 only
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


  reply	other threads:[~2011-03-10 21:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 17:16 Memcache reset on rails 2.3 with preload Troex Nevelin
2011-03-10 20:48 ` Clifton King [this message]
2011-03-10 21:23 ` Eric Wong
2011-03-10 22:14   ` Clifton King
2011-03-10 22:01 ` Lawrence Pit
2011-03-23 18:25   ` Troex Nevelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTik_90ERYfZgQp0PSWZ6DQE54jQvtWjqZbL+2-ZS@mail.gmail.com \
    --to=cliftonk@gmail.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).