# Regarding memcache client

**URL:** <https://www.ruby-forum.com/t/regarding-memcache-client/66940>\
**Category:** Ruby\
**Created:** [August 30, 2006, 2:27pm UTC](https://www.ruby-forum.com/t/regarding-memcache-client/66940 "2006-08-30T14:27:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemant\_kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hemant\_kumar](https://www.ruby-forum.com/u/hemant_kumar)\
**Post date:** [August 30, 2006, 2:27pm UTC](https://www.ruby-forum.com/t/regarding-memcache-client/66940/1 "2006-08-30T14:27:02Z")

</div>

Hi,

I am using memcache-client written by beloved 🙂 eric hodel for session  
caching in rails, and but I would like to use this for some in-memory  
caching in my other programs.

I am not able to use it outside rails somehow. require ‘memcache’  
throws, no  
such file to load, when I have the gem in  
"/usr/lib/ruby/gems/1.8/gems/memcache-client-1.3/ and rails is using it  
allright.

The API for memcache also doesn’t make it clear, how do I use it in my  
own  
applications. can anyone clarify on this?

Also, when using CachedModel for activerecord caching…how exactly it  
works?  
how often will it do read and write to db?

What exactly is meant by “in-process” caching that CacheModel does?  
Also the after\_filter stuff that is supposed to flush the local cache in  
rails, I would like to know what is meant by “local cache” stuff and how  
it  
determines when to flush that content?

---

<div class="post-metadata">

**Author:** ![hemant\_kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hemant\_kumar](https://www.ruby-forum.com/u/hemant_kumar)\
**Post date:** [August 30, 2006, 5:15pm UTC](https://www.ruby-forum.com/t/regarding-memcache-client/66940/2 "2006-08-30T17:15:23Z")

</div>

If mechanize was installed as a gem do you have:  
require ‘rubygems’  
before the:  
require ‘mechanize’

---

<div class="post-metadata">

**Author:** ![hemant\_kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hemant\_kumar](https://www.ruby-forum.com/u/hemant_kumar)\
**Post date:** [August 31, 2006, 2:10am UTC](https://www.ruby-forum.com/t/regarding-memcache-client/66940/3 "2006-08-31T02:10:38Z")

</div>

On Aug 30, 2006, at 5:26 AM, hemant kumar wrote:

> allright.  
> You probably forgot to require ‘rubygems’.

> The API for memcache also doesn’t make it clear, how do I use it in  
> my own  
> applications. can anyone clarify on this?

Start with the documentation:

[http://dev.robotcoop.com/Libraries/memcache-client/index.html](http://dev.robotcoop.com/Libraries/memcache-client/index.html)

How you use it in your own application depends upon what you want to  
cache.

> Also, when using CachedModel for activerecord caching…how exactly  
> it works?  
> how often will it do read and write to db?

[http://dev.robotcoop.com/Libraries/cached\_model/index.html](http://dev.robotcoop.com/Libraries/cached_model/index.html)

CachedModel has write-through behavior.

> What exactly is meant by “in-process” caching that CacheModel does?  
> Also the after\_filter stuff that is supposed to flush the local  
> cache in  
> rails, I would like to know what is meant by “local cache” stuff  
> and how it  
> determines when to flush that content?

The local cache is just a hash. If you don’t flush it it will fill  
up your memory with ActiveRecord objects. I recommend not using it.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
