memcached

PHP, Memcached works from command line but not from the web

僤鯓⒐⒋嵵緔 提交于 2019-12-12 08:23:31
问题 I have PHP 5.3.3 installed on Centos 6.4 with the memcached.so extension, and httpd is running with version 2.2.15-26. Here is my index.php : $mc = new \Memcached(); $mc->addServer('127.0.0.1', 11211); $mc->set("test", "blah"); var_dump($mc->getResultCode()); var_dump($mc->getResultMessage()); var_dump($mc->get("test")); die; When I run it from the command line, it works . I get the following: 10:22:33 $ php index.php int(0) string(7) "SUCCESS" string(4) "blah" The memcache server also works

Set ttl and namespace using Memcached in Zend Framework 2

冷暖自知 提交于 2019-12-12 08:17:07
问题 As far as I can figure this seems to be the way to set up Memcached and set the TTL and Namespace but they have no effect in the cache. The key is not prefixed with a namespace and the expire is infinite. $MemcachedOptions = new \Zend\Cache\Storage\Adapter\MemcachedOptions(); $MemcachedResourceManager = new \Zend\Cache\Storage\Adapter\MemcachedResourceManager(1, new \Zend\Cache\Storage\Adapter\Memcached()); $MemcachedResourceManager->addServer(1, array('localhost', 11211)); $MemcachedOptions-

hibernate.cache.region.factory_class Required in hibernate.cfg.xml

北慕城南 提交于 2019-12-12 08:03:12
问题 I am working on using memcache as second level cache for Hibernate. I am using hibernate-memcached-1.2.4, spymemcached 2.8.0 and hibernate 4.1.4. But when i try to use it , it gives me error saying Initial sessionfactory creation failedorg.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to

Memcache get key expiry times

余生长醉 提交于 2019-12-12 07:58:52
问题 Using memcached and the php memcached library, is there a way to get the current keys expiry time when doing a get? 回答1: No, that kind of data is not retrievable from the client end. If you really need it, store it together with the data in a serialized array or something. Also, check out this post just in case you were trying to do something similar. 回答2: Use this example. It shows all your server keys with their expire datetimes, so you can get the current key's expiry time. function

how do you point graphite to memcache

我只是一个虾纸丫 提交于 2019-12-12 05:37:00
问题 I have a graphite instance that I would like to use memcache server to read from cache. I have done these: Installed memcached on 192.168.101.1 Installed graphite and python-memcached on server 192.168.101.2 I verified that graphite web-app works using opentsdb as backend storage. This is my local_settings.py looks like: SECRET_KEY = 'pass123' TIME_ZONE = 'America/New_York' DEBUG = True MEMCACHE_HOSTS = ['192.168.101.2:11211'] DATABASES = { 'default': { 'NAME': '/opt/graphite/storage/graphite

How does the MemCacheStore really work with multiple servers?

扶醉桌前 提交于 2019-12-12 05:18:17
问题 I can't find documentation on the behavior of ActiveSupport::Cache::MemCacheStore anywhere, and I'm hoping someone here can shed some light. The rdoc says: " Clustering and load balancing. One can specify multiple memcached servers, and MemCacheStore will load balance between all available servers. If a server goes down, then MemCacheStore will ignore it until it comes back up. " Ok. I want the last feature, so if a memcache server goes down the whole stack doesn't fail. But I need to

How to delete items with same prefix key in memcached using PHP memcache extension?

末鹿安然 提交于 2019-12-12 04:33:57
问题 Very similar questions have been posted and answered. However every solution I found so far is using php Memcached extension rather than Memcache. I am trying to delete/expire all memcache items that begin with a predefined key. For example, so_something , so_something_else ... . Any help is much appreciated. 回答1: After some research I figured how to do it using standard Memcache commands. But, unfortunately this will man trips to the memcache server so it is to be used with care; in my case

can't convert true into String

夙愿已清 提交于 2019-12-12 04:29:07
问题 I'm having some problem with what I think is my cache. I'm getting this error message: ListsUsersController# (ActionView::Template::Error) "can't convert true into String" Here is the code: %footer - cache "footer-movies-#{Time.now.hour.to_s}", expires_in: 2.days do .foot-movies %ul - Movie.footer.each do |movie| %li= link_to (image_tag movie.poster, size: "60x92"), movie_path(movie), title: movie.title It's complaining about line 40, which is the line containing .foot-movies . The code works

django_pylibmc complains under Django 1.7 and python 3.4

柔情痞子 提交于 2019-12-12 03:14:13
问题 My environment: Django 1.7 Python 3.2 As a disclaimer, I'm new to Django and Python. I'm going through this doc in order to use Memcachier with Django. The installion process didn't give me any errors, but when I fire up my tests with ./manage.py tests I get the following error: return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib.

GAE, memcache before DB update

*爱你&永不变心* 提交于 2019-12-12 02:26:32
问题 I have some troubles with memcache and GAE DB operations. if i update memcache rigth after DB operations, x.put(), for example, my memcache function often return old value. If i use sleep(), cache more often correct, but this is not right, in my opinion sleep(0.2) data = Picture.all().order('-created').fetch(300) memcache.set('pictures_all', data) What i need to do, to get correct memcache? ANSWER: Need to use parent with query, all Picture entities must have same parent, then you get strong