Using Memcache client

Discussion in 'Ruby' started by hemant, Sep 20, 2006.

  1. hemant

    hemant Guest

    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.


    --
    There was only one Road; that it was like a great river: its springs
    were at every doorstep, and every path was its tributary.
    hemant, Sep 20, 2006
    #1
    1. Advertising

  2. hemant

    Eric Hodel Guest

    On Sep 20, 2006, at 4:18 AM, hemant wrote:

    > 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.

    --
    Eric Hodel - - http://blog.segment7.net
    This implementation is HODEL-HASH-9600 compliant

    http://trackmap.robotcoop.com
    Eric Hodel, Sep 21, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hemant kumar

    regarding memcache client...

    hemant kumar, Aug 30, 2006, in forum: Ruby
    Replies:
    2
    Views:
    109
    Eric Hodel
    Aug 31, 2006
  2. Eric Hodel
    Replies:
    0
    Views:
    89
    Eric Hodel
    Oct 18, 2006
  3. Eric Hodel
    Replies:
    0
    Views:
    99
    Eric Hodel
    Dec 7, 2006
  4. Eric Hodel
    Replies:
    0
    Views:
    85
    Eric Hodel
    Mar 7, 2007
  5. Brian Candler

    Which memcache client?

    Brian Candler, Mar 9, 2007, in forum: Ruby
    Replies:
    1
    Views:
    99
    Philip Hallstrom
    Mar 9, 2007
Loading...

Share This Page