Displaying 20 results from an estimated 8000 matches similar to: "creating a cache in rails"
2006 Apr 20
12
memcache, sessions, fragments, oh my!
Hi all -
I am trying to get rails to use memcache for sessions and fragment
caching. I''d also like to use the same connection for general caching of
this and that.
I''m following the instructions here:
http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore
and hitting a brick wall.
I''m using the new memcache-client since from what I''ve read
2006 Aug 24
10
MongrelCluster - How can I make a request to a specific mongrel instance?
In our app we''ve a number of singleton ruby classes that cache static data
in hashes, things like
string values, system config params, etc). In a webbrick environment this
works ok, but we find
in production we have a problem because we have 4 caches, one for each
mongrel instance.
This also isn''t a BIG problem, but our cache.reload() methods are kinda
useless now, because
we
2005 Dec 15
5
Rails vs. J2EE: Sharing state in memory?
Hi,
I am from a Java background and pretty new to Ruby and Rails.
What I am wondering is how I would shared state accross requests and users
without involving IO, i.e. use memory.
My current understanding is that for each request a new process ist spawn
and therefore it gets its own memory. So no sharing can take place between
requests?
Do I understand this right? For those who know
2007 Feb 02
6
Mongrel and MemcacheSessionStore
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
I''ve been using Mongrel for quite some time now but I ran into an issue
that threw me back to lighttpd + fastcgi.
The application in question was running fine in the production
environment with SQLSessionStore and using a mongrel cluster behind a
load balancer. However, by switching to a MemcacheSessionStore (using
either
2007 Aug 21
7
mocking singletons
How can I safely mock a singleton without the mocked method living on
outside the scope of the test method?
I''ve run into this problem with mocking methods on globals (gasp!) in
the past by doing something like
def mock_my_global
original = $my_global
$my_global.expects(:foo).returns(''bar'')
yield
$my_global = original
end
Is there something similar I
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
I''m trying to add some per-object behaviors to objects descended from
ActiveRecord, by using after_initialize() and instance_eval(), like this:
def after_initialize
self.instance_eval(File.read(''customers/default.rb''))
end
(Ultimately the file path will be dynamic, this is just proof of concept.)
default.rb just contains a few method definitions like this one:
def
2018 Jan 30
2
Samba 4.7.4 + bind9 DLZ /backend/ dropping delegated domain
No, I'm reading the dlz_bind9.c code.
I've found and fixed the problem. It turns out that using a reference
counted singleton is a bad idea. The singleton is defunct after reload.
If we simply create a new state object and destroy the old one as bind is
trying to let us do, things work out fine.
This works, at least, for bind9.9. I cant test with the older (9.8), so it
is possible that
2011 Apr 29
3
questions about cookies when bridging together two rails apps
Hey all,
I am looking through this example Rails app where a user session is
stored in cookie so user signs up in one rails app and navigates to
another while still being signed in as unique user. I come across this
line of code where I don''t understand where some of these methods are
coming from:
@session = Session.create!(:user => @user)
cookies[:session_token] = {:value
2006 Jul 25
3
Question about how Mongrel process works with singletons
Hi,
I have a controller where I access a singleton class that I use to
connect to a DRbprocess
DrbConnector.instance.some_method
I notice that on every request, the constructor is called so it is
making a new instance of this singleton. Is this normal?
Thanks,
Curtis
2006 Apr 08
6
Deploy with Capistrano Win32 -> Linux
Im trying to deploy with capistrano from win32 to Linux but no success.
I''ve been installed: cwRsync to ssh
I ran
rake remote:exec ACTION=setup --trace
and get:
Anyone knows how to get capistrano log ssh comunication?
Any idea?
Thanks
rake aborted!
End of file reached
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.8/lib/net/ssh/transport/version-negot
iator.rb:51:in `readline''
2012 Mar 16
2
Singleton pattern
Hi all,
I know it may not have much sense thinking about a Singleton Pattern in an
R application which doesn't use any OOP facilities, however I'm curious to
know if anybody faced the same issue. I've been googling but using
"singleton pattern" as a key word leads to typical OOP languages like Java
or C++ among others.
So my problem is that I'd like to ensure some very
2004 Oct 18
2
Recoding factors
I'm having a bit of trouble recoding factors in a fields.
I have a field which has the factors Singleton, Twin and Triplet.
I want to recode the field to have only the factors Singleton and
Multiple.
Any advice?
Cheers,
Neil
2004 Nov 11
0
[LLVMdev] LLVM and memory leaks
I guess the issue of singleton objects leaking is not something that he
LLVM team is very concerned about, since there has been no replies to my
first mail... But for me it is a big problem. I can't use LLVM in our
project if it triggers our leak detection system, since it will hide
other problems.
Since actually deleting these objects is proving difficult (types can
have circular
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
Hello Railists,
I have a piece of Ruby on Rails code that has a complex SQL query (well, not
that complex, but as far as I know beyond the ORM capabilities) and for my
taste it has too many strings and harcoded values. I''d like to improve it as
much as possible, so my question is open ended, what else can I do to
improve it?
Some particular issues I have
- Is there a way to get a table
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task
for a given user.
>From a controller, I imagine something like:
def start_job
MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task,
:data => { :user_id = current_user.id })
end
def check_job
@status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id]
end
2007 Oct 04
0
[LLVMdev] RFC: Tail call optimization X86
On 4 Oct 2007, at 00:22, Evan Cheng wrote:
>> ifeq ($(ARCH),x86)
>> LLCBETAOPTION := -regalloc=local -fast -tail-call-opt -tail-call-opt-
>> align-stack
> Please remove -regalloc=local -fast. We want to test this patch
> separately.
just did a test with
LLCBETAOPTION := -tail-call-opt -tail-call-opt-align-stack
this time only SPASS llc-beta fails (comparing with vanilla
2006 Nov 04
13
Caching application data
Hi,
say my application has a small 20 row information table in the database
that stores names of airlines:
"continental", "delta", united" , etc...
These names will be used in various pages of the application for all the
website users for different actions. They do not expect to change often.
what I do now is - when a user logs in - these airline names are queried
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi,
In my user_controller.rb, I have the following method, which is supposed
to send the user to their profile, dependng on what "role" they are (the
roles correspond to the other controllers: venue, band, fan):
def login
if request.post?
if session[:user_id] = User.authenticate(params[:user][:login],
params[:user][:password])
flash[:message] =
2007 Nov 25
4
is notify resevered word?
Hi,
When I added this association...
class User < ActiveRecord::Base
has_one :notify
end
...and tried then to update column in User table it will call queries
for notify table automatic?
Output
---------------------------------------------------------------
User Columns (0.041488) SHOW FIELDS FROM `users`
User Load (0.001544) SELECT * FROM `users` WHERE (`users`.`nickname`
=