Oracle 5.0 Reference Manual page 1395

Table of Contents

Advertisement

$result = $mysqli->query($sql);
if (!$result) {
sprintf("Database error: (%d) %s", $mysqli->errno, $mysqli->error);
exit;
}
$row = $result->fetch_assoc();
$memc->set($row['title'], $row);
printf("<p>Loaded (%s) from MySQL</p>", htmlspecialchars($row['title'], ENT_QUOTES, 'UTF-8');
}
}
?>
</body>
</html>
With PHP, the connections to the
associated Apache instance remain running. When adding or removing servers from the list in a
running instance (for example, when starting another script that mentions additional servers), the
connections are shared, but the script only selects among the instances explicitly configured within the
script.
To ensure that changes to the server list within a script do not cause problems, make sure to use the
consistent hashing mechanism.
15.6.3.7. Using MySQL and
There are a number of different modules for interfacing to
client library provides a native interface to
MemCache
libraries, such as libmemcached. You can obtain the installer package from
projects/RMemCache.
To install, extract the package and then run install.rb:
shell> install.rb
If you have RubyGems, you can install the
shell> gem install Ruby-MemCache
Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency io-reactor? [Yn]
Successfully installed Ruby-MemCache-0.0.1
Successfully installed io-reactor-0.05
Installing ri documentation for io-reactor-0.05...
Installing RDoc documentation for io-reactor-0.05...
To use a
memcached
require '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:
require 'memcache'
memc = MemCache::new '192.168.0.100:11211:3'
To add servers to an existing list, you can append them directly to the
memc += ["192.168.0.101:11211"]
To set data into the cache, you can just assign a value to a key within the new cache object, which
works just like a standard Ruby hash object:
memc["key"] = "value"
Developing a
memcached
instances are kept open as long as the PHP and
memcached
with Ruby
memcached
Ruby-MemCache
instance from within Ruby, create a new instance of the
1375
Application
within Ruby. The
memcached
that does not require any external
memcached
gem:
y
MemCache
Ruby-
http://www.deveiate.org/
object.
MemCache
object:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents