89577

89577



Using MySQL and memcached with Ruby

There are a number of different modules for interfacing to memcached within Ruby.

The Ruby-

MemCache Client library provides a native interface to memcached that does not require any external

libraries, such as libmemcached. You can obtain the installer packagefrom

http://www.deveiate.org/

projects/RMemCache.

To install, extract the package and then run install. rb:

shell> install. rb

If you have RubyGems, you can install the Ruby-MemCache gem: shell> gem install Ruby-MemCache

Bulk updating Gem source index for: http://gems.rubyforge.org Install reąuired dependency io-reactor? [Yn] y Successfully installed Ruby-MemCache-O.0.1 Successfully installed io-reactor-O.05 Installing ri documentation for io-reactor-O.05...

Installing RDoc documentation for io-reactor-O.05...

To use a memcached instance from within Ruby, create a new instance of the MemCache object. reąuire 'memcache’

memc = MemCache::new '192.168.0.100:11211'

You can add a weight to each server to increase the likelihood of the server being selected during

hashing by appending the weight count to the server host name/port string:

reąuire 'memcache'

memc - MemCache::new '192.168.0.100:11211:3'

To add servers to an existing list, you can append them directly to the MemCache object:

memc +- ("192.168.0.101:11211"]

To set data into the cache, you can just assign a value to a key within the newcache object, which

works just like a standard Ruby hash object:

memc("key"] - "value"



Wyszukiwarka

Podobne podstrony:
Using MySQL Proxy There are a number of different ways to use MySQL Proxy. At the most basie level,
Using GTlDs for Failover and Scaleout There are a number of techniques when using MySQL Replication
Using MySQL and memcachedwith Python The Python memcachemodule interfaces to memcachedservers, and i
Step Four STEP FOURPost YourJob While there are a couple of different Online sites to hire V.A.s, on
tape-recorded conversations. In excerpt (4), for instance, there are a number of markings which are
UHAM095 78 ^ UNDERSTANDING HEADACHES AND M I G RAI N ES Aromatherapy: There are many aromatherapy as
Art and culture The art and culture of Lodź develop dynamically and on many levels.There are 10 thea
physics and relashioships topic-specific vocabularyPhysical appearance Taik 2. There are loti of Eng
ANNA sum09 USA12 textures. species and featfers that the possifcditres are endkess. The same goes fo
system 22 22 later as most strengthening to the digestion and the intestinal functions. There are ot
individual lives; and there are pockets of severe deprivation within the United States) but the U.S.
PRIOR TO DEPARTURE, UNBERTHING, BERTHING AND NAVIGATION WITH PILOT EMBARKED - RIGHT SIDE OF “LOG BOO
m144 Tabard of the Herald of the Duchy of Burgundy, in bluc and gold with a red border. Each region
IB0 4. Kicking to The Head - Upper Level Kicks There are a variety of kicks depending on the t
PRIOR TO DEPARTURE, UNBERTHING, BERTHING AND NAVIGATION WITH PILOT EMBARKED - RIGHT SIDE OF “LOG BOO

więcej podobnych podstron