memcached

Use cache money only for a single model?

Deadly 提交于 2019-12-07 11:41:41
问题 I want to use cache-money but I don't want to start automatically caching everything (I'm working with a large production app, terabytes of data etc). How do I use it for only the models that I specify? Right now I've got: # initializers/cache_money.rb require 'cache_money' config = (cfg = YAML.load(IO.read(File.join(RAILS_ROOT, "config", "memcached.yml"))))[RAILS_ENV] || cfg["defaults"] $memcache = MemCache.new(config) $memcache.servers = config['servers'] $local = Cash::Local.new($memcache)

Will Django's cache modules work on Google App Engine?

我的未来我决定 提交于 2019-12-07 10:31:26
问题 I am running Django (1.0.2) on Google App Engine, and would like to know which (if any) of the following Django caching modules ought to inherently work with Google's memcache implementation: Middlewear django.middleware.cache.UpdateCacheMiddleware django.middleware.common.CommonMiddleware django.middleware.cache.FetchFromCacheMiddleware Decorators django.views.decorators.cache.cache_page Template fragment caching In a template: {{ load cache }}{% cache 500 cache_name %}...cached...{%

Fatal error: Class 'Memcached' not found in /my/path

主宰稳场 提交于 2019-12-07 09:11:42
问题 When I try : $mc= new Memcached(); I get Fatal error: Class 'Memcached' not found in /my/path phpinfo says that /etc/php5/apache2/conf.d/20-memcached.ini is loaded as an additional .ini file. The content of this file is this one : ; uncomment the next line to enable the module extension=memcached.so dpkg --get-selections | grep memcached libmemcached6 install memcached install php5-memcached install Kubuntu Apache 2.0 php 5.4.4-1 Why do I have this fatal error ? 回答1: Based on your comment I

Memcached常用命令及使用说明

别说谁变了你拦得住时间么 提交于 2019-12-07 08:08:49
一、存储命令 存储命令的格式: <command name> <key> <flags> <exptime> <bytes> <data block> 参数说明如下: <command name> set/add/replace <key> 查找关键字 <flags> 客户机使用它存储关于键值对的额外信息 <exptime> 该数据的存活时间,0表示永远 <bytes> 存储字节数 <data block> 存储的数据块(可直接理解为key-value结构中的value) 1、添加 (1)、无论如何都存储的set 这个set的命令在memcached中的使用频率极高。set命令不但可以简单添加,如果set的key已经存在,该命令可以更新该key所对应的原来的数据,也就是实现更新的作用。 可以通过“get 键名”的方式查看添加进去的记录: 如你所知,我们也可以通过delete命令删除掉,然后重新添加。 (2)、只有数据 不存在 时进行添加的add (3)、只有数据 存在 时进行替换的replace 2、删除 可以看到,删除已存在的键值和不存在的记录可以返回不同的结果。 二、读取命令 1、get get命令的key可以表示一个或者多个键,键之间以空格隔开 2、gets 可以看到,gets命令比普通的get命令多返回了一个数字(上图中为13)。这个数字可以检查数据是否发生改变

XMemcached实例及与spring的集成

情到浓时终转凉″ 提交于 2019-12-07 08:08:35
1.Memcached Client简要介绍 Memcached Client目前有3种: 1. Memcached Client for Java 2. SpyMemcached 3. XMemcached 这三种Client一直存在各种争议: Memcached Client for Java 比 SpyMemcached更稳定、更早、更广泛;SpyMemcached 比 Memcached Client for Java更高效;XMemcached 比 SpyMemcache并发效果更好。 具体可以参考官方性能对比: Memcached Client for Java: https://github.com/gwhalin/Memcached-Java-Client/wiki/PERFORMANCE XMemcached: http://xmemcached.googlecode.com/svn/trunk/benchmark/benchmark.html 2.XMemcached特性 高性能;支持完整的memcached文本协议,二进制协议;支持JMX,可以通过MBean调整性能参数、动态添加/移除server、查看统计等;支持客户端统计;支持memcached节点的动态增减;支持memcached分布:余数分布和一致性哈希分布;更多的性能调整选项。 3

memcached 常用命令及使用说明

南笙酒味 提交于 2019-12-07 08:08:24
1、启动Memcache 常用参数 -p <num> 设置TCP端口号(默认设置为: 11211) -U <num> UDP监听端口(默认: 11211, 0 时关闭) -l <ip_addr> 绑定地址(默认:所有都允许,无论内外网或者本机更换IP,有安全隐患,若设置为127.0.0.1就只能本机访问) -c <num> max simultaneous connections (default: 1024) -d 以daemon方式运行 -u <username> 绑定使用指定用于运行进程<username> -m <num> 允许最大内存用量,单位M (默认: 64 MB) -P <file> 将PID写入文件<file>,这样可以使得后边进行快速进程终止, 需要与-d 一起使用 更多可以使用者 memcached -h 在linux下:./usr/local/bin/memcached -d -u root -l 192.168.1.197 -m 2048 -p 12121 在window下:d:\App_Serv\memcached\memcached.exe -d RunService -l 127.0.0.1 -p 11211 -m 500 在windows下注册为服务后运行: sc.exe create Memcached_srv binpath= “d:\App

Memcache vs MySQL in memory

人盡茶涼 提交于 2019-12-07 07:16:22
问题 I have a database that won't grow much in size. It's current size is about 1 GB. Achieving the fastest performance is desired. Question : When should I use Memcache vs simply using MySQL Innodb ability to store all my content within RAM (innodb_buffer_pool_size)? 回答1: I would only resort to memcached if you require more than one server to hold everything in RAM. Otherwise, you're adding complexity for not much functionality. 回答2: mysql is more performance degradated on much threads then

Magento sessions disappearing with memcache turned on

随声附和 提交于 2019-12-07 07:04:59
问题 We are having an issue where we have sessions disappearing randomly from Magento 1.10, when we have memcache enabled (on an nginx web server). It does not seem to matter what we set the cookie expiration time to in Magento, for some reason any random time within an hour the session goes away. If we turn memcache off, it works fine. We will eventually need multiple servers connecting to one session based caching solution, so memcache seems like the only option. Also, we are only caching

PHP memcache - check if any server is available in pool?

荒凉一梦 提交于 2019-12-07 06:28:42
问题 I have the following code: $cluster['local'] = array('host' => '192.168.1.1', 'port' => '11211', 'weight' => 50); $cluster['local2'] = array('host' => '192.168.1.2', 'port' => '11211', 'weight' => 50); $this->memcache = new Memcache; foreach ($this->cluster() as $cluster) { $this->memcache->addServer($cluster['host'], $cluster['port'], $this->persistent, $cluster['weight'], 10, 10, TRUE , 'failure' ); } I would like to make a function that checks if any of my servers in my memcache Pool is

Selecting an appropriate cache mechanism

拈花ヽ惹草 提交于 2019-12-07 06:02:43
问题 My setup: 4 webservers Static content server (NFS mount) 2 db servers 2 "do magic" servers An additional 8 machines designated multi-purpose. I'm writing a wrapper for three caching mechanisms so that they can be used in a somewhat normalized manner: Filesystem, Memcached and APC. I'm trying to come up with examples for use (and what to actually put in each cache). File System Handles content that we generate and then statically serve. RSS feeds, old report data, user specific pages, etc...