Using Memcache client

H

hemant

Some some simple/[stupid|smart] questions about memcache.

I am using the wrapper written by Eric Hodel.

1. Is it thread safe? By that I mean..lets say, I have one thread
that writes to it and the other reads from it. How will it behave
then. Please note that, only one thread will be used to write to
it..rest all will just read. I see..mutex.synchronize in the code..so
should be theoretically thread safe.

2. I start a program, connect to the server using MemCache.new on a
new namespace and do some data manipulation. Then i don't need to
close the connection, right? Do i need to delete the keys that i put?
or they will expire.

Here...I am using it outside rails domain.
 
E

Eric Hodel

Some some simple/[stupid|smart] questions about memcache.

I am using the wrapper written by Eric Hodel.

1. Is it thread safe? By that I mean..lets say, I have one thread
that writes to it and the other reads from it. How will it behave
then. Please note that, only one thread will be used to write to
it..rest all will just read. I see..mutex.synchronize in the code..so
should be theoretically thread safe.

Some of the documentation lies, but, see: ri MemCache.new
2. I start a program, connect to the server using MemCache.new on a
new namespace and do some data manipulation. Then i don't need to
close the connection, right? Do i need to delete the keys that i put?
or they will expire.

Don't worry about it, memcached will take care of the stored data for
you. Ruby's GC will take care of closing connections for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top