memcached

Combining cache methods - memcache/disk based

流过昼夜 提交于 2019-12-07 04:56:12
问题 Here's the deal. We would have taken the complete static html road to solve performance issues, but since the site will be partially dynamic, this won't work out for us. What we have thought of instead is using memcache + eAccelerator to speed up PHP and take care of caching for the most used data. Here's our two approaches that we have thought of right now: Using memcache on >>all<< major queries and leaving it alone to do what it does best. Usinc memcache for most commonly retrieved data,

How to cache an arbitrary object in Rails(time-based)?

▼魔方 西西 提交于 2019-12-07 04:15:31
问题 I read the official guide. It says there are page cache , action cache and fragment cache , but they are not what I want. I just like to cache an object, not the whole page or fragment of view, like this pseudocode: def show cache @ads, :expires_in => 1.hour do @ads = Advertisement.all do end Is it possible? with memcache or redis ? 回答1: Try this: #To cache the object Rails.cache.write('cache-key', object) #Load the object from the cache Rails.cache.read('cache-key') 回答2: Check out the

Rails, Passenger and Memcached: Unable to find server during initialization

瘦欲@ 提交于 2019-12-07 04:03:53
问题 I hope someone can help me with a problem that I am certain is a user error. The configuration details below work in all my other environments including integration, development and qa. However, the production servers give the following error: <ActionController::Session::MemCacheStore:0x2b45f6acb248> unable to find server during initialization. When I telnet to the memcached box from the server having the problem and run 'stats', I get: STAT pid 16136 STAT uptime 7398638 STAT time 1275059978

GAE: memcache: is it the same across multiple app instances

試著忘記壹切 提交于 2019-12-07 02:50:18
问题 I have a pretty basic question: In GAE, if I use memcache to store some data once it was retrieved for the first time from the db, if then that data remains in the cache for like 2 days, do ALL instances of said application get to "see" it and retrieve it from cache? Or is the cache separate for each application instance? I'm asking this because I've seen that due to the way that GAE spawns separate VM processes (not threads) for each new instance an application needs, stuff that used to be

Django-nonrel ≤1.3 and Memcache on Google App Engine

。_饼干妹妹 提交于 2019-12-07 02:33:56
问题 I'm a designer still trying to code up my first app in Google App Engine as an experiment. I have got to the point where I want to set up memcache to cache my entire site following the instructions at: http://docs.djangoproject.com/en/dev/topics/cache/#memcached I am clear that I need to add in my settings.py the following: CACHE_BACKEND = 'memcached:// [IP ADDRESS] : [PORT] /' And then: MIDDLEWARE_CLASSES = ( 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common

Rails Action Caching for user specific records

放肆的年华 提交于 2019-12-07 02:13:25
问题 I am a rails newbie trying to implement caching for my app. I installed memcached and configured it in my development.rb as follows: config.action_controller.perform_caching = true config.cache_store = :mem_cache_store I have a controller ProductsController that shows user specific products when they are logged in. class ProductsController < ApplicationController caches_action :index, :layout => false before_filter :require_user def index @user.products end end The route for index action is:

How can I install the php memcached extension on Docker's PHP7 Alpine image?

ぐ巨炮叔叔 提交于 2019-12-07 01:01:05
问题 The official php7 docker image has the following example: FROM php:7.0-fpm RUN apt-get update && apt-get install -y libmemcached-dev \ && pecl install memcached \ && docker-php-ext-enable memcached I'm trying to use FROM php:7.0-fpm-alpine : RUN apk add --update --no-cache libmemcached-dev RUN pecl install memcached && docker-php-ext-enable memcached PECL gives this error: pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.13

docker link使用示例

好久不见. 提交于 2019-12-06 20:53:06
创建dockerfile,本文将dockerfile命名为Dockerfile_memcached(文件名可随意定义): # Memcached # # VERSION 2.2 FROM ubuntu:12.04 MAINTAINER Marker.King <majk@vip.qq.com> # make sure the package repository is up to date RUN echo "deb http://mirrors.aliyun.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update # install memcached RUN apt-get install -y memcached # Launch memcached when launching the container ENTRYPOINT ["memcached"] # run memcached as the daemon user USER daemon # expose memcached port EXPOSE 11211 根据dockerfile构建镜像: $ docker build -t memecached - < Dockerfile_memcached

Failed to write session data, php and memcached

孤街醉人 提交于 2019-12-06 18:19:48
问题 I have recently tried implementing memcached for session saving in php. I modified the session.save_handler in my php.ini and for the most part it works correctly. Sessions are saved in it. However, once in a while, I get this weird message for certain sessions: PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (x.x.x.x:11211) in Unknown on line 0. The session data is the same, way under the 1MB barrier of

linux环境Memcached的部署

拟墨画扇 提交于 2019-12-06 15:47:04
一、安装libevent函数库 下载地址:http://libevent.org 默认被安装到:/usr/local/lib目录下 安装memcached之前需要先安装libevent函数库。 可以通过 ls -al /usr/local/lib | grep libevent 命令查看是否已安装libevent函数库。 如果没安装,则需下载并安装libevent函数库。 二、安装memcached 下载地址:http://memcached.org 默认被安装到:/usr/local/bin目录下 安装完毕后, 先将libevent包路径加入/etc/ld.so.conf文件中 #vi /etc/ld.so.conf 在最后面一行加入/usr/local/lib 完成后输入以下命令 启动 memcached主程序 /usr/local/bin/memcached -d -m 1024 -u root -l memcached所在的 服务器 ip地址 -p 11211 -c 1024 -P /tmp/memcached.pid 常用启动参数如下: -m:最大内存使用,单位MB。默认64MB。 -p:进程所使用的TCP进程端口,默认11211。 -d:将memcached作为后台守护进程运行。 -u:以哪个用户的身份运行 (仅在以root运行的时候有效) -P:进程文件存放路径。