Support memcached warm-restart

Which chart: stable/memcached, latest version Description WDYT Adding support for https://github.com/memcached/memcached/wiki/WarmRestart ? It could be an opt-in feature using a PVC. This will make memcached upgrades less impacting, as the cache will survive restart. Steps to reproduce the issue: implement featuredo upgrades / restartverify that cached elements are still present in mc Describe the results you received: State will be lost on upgrade Describe the results you expected: Keep state Additional information you deem important (e.g. issue happens only occasionally): N/A Version of Helm and Kubernetes: N/A Output of helm version: N/A Output of kubectl version: N/A I've also forked the helm-project stable/mcrouter chart and I'm cleaning this up – let me know if you want it upstream.该提问来源于开源项目:bitnami/charts Some more background: https://groups.google.com/forum/#!msg/memcached/faWH90ivfE4/QPVMGSKiBAAJ The volume should survive pod-recreates, but be mounted on tmpfs. The chart need not worry about that and just use a pvc, this could be handled by for instance openebs localpv provisioner which uses a volume mounted on top of tmpfs.

[bitnami/memcached] fix ServiceMonitor

The ServiceMonitor is invalid: console error validating data: ValidationError(ServiceMonitor.spec.selector): unknown field "app.kubernetes.io/component" in com.coreos.monitoring.v1.ServiceMonitor.spec.selector This is caused by a label selection statement with a bad indentation [x] Chart version bumped in Chart.yaml according to semver.[x] Variables are documented in the README.md[x] Title of the PR starts with chart name (e.g. [bitnami/chart])[x] If the chart contains a values-production.yaml apart from values.yaml, ensure that you implement the changes in both files该提问来源于开源项目:bitnami/charts plz look

Support memcached warm-restart

Which chart: stable/memcached, latest version Description WDYT Adding support for https://github.com/memcached/memcached/wiki/WarmRestart ? It could be an opt-in feature using a PVC. This will make memcached upgrades less impacting, as the cache will survive restart. Steps to reproduce the issue: implement featuredo upgrades / restartverify that cached elements are still present in mc Describe the results you received: State will be lost on upgrade Describe the results you expected: Keep state Additional information you deem important (e.g. issue happens only occasionally): N/A Version of Helm and Kubernetes: N/A Output of helm version: N/A Output of kubectl version: N/A I've also forked the helm-project stable/mcrouter chart and I'm cleaning this up – let me know if you want it upstream.该提问来源于开源项目:bitnami/charts Some more background: https://groups.google.com/forum/#!msg/memcached/faWH90ivfE4/QPVMGSKiBAAJ The volume should survive pod-recreates, but be mounted on tmpfs. The chart need not worry about that and just use a pvc, this could be handled by for instance openebs localpv provisioner which uses a volume mounted on top of tmpfs.

memcached ?报错

tomcat+memcached 2台服务器分别运行2个tomcat,前端nginx负载,memcached安装后tomcat配在文件如下,但seesion 共享不成功 tomcat配置文件    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> –> <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"             memcachedNodes="n1:192.168.1.126:11211"             requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"             sessionBackupAsync="false"             sessionBackupTimeout="100"             transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"             copyCollectionsForSerialization="false" />       <!– Use the LockOutRealm to prevent attempts to guess user passwords            via a brute-force attack –> [root@user2 bin]#  memcached -d -m 256 -p 11211 -u root -l 192.168.1.126 -v failed to listen on TCP port 11211: Address already in use 这算是报错么? memcache没有启动成功,11211端口被占用。

安装libevent2执行 make install时报错:

Libraries have been installed in:    /usr/local/memcached/libevent-2.1.12-stable/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following:    – add LIBDIR to the 'LD_LIBRARY_PATH' environment variable      during execution    – add LIBDIR to the 'LD_RUN_PATH' environment variable      during linking    – use the '-Wl,-rpath -Wl,LIBDIR' linker flag    – have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ———————————————————————-  /bin/mkdir -p '/usr/local/memcached/libevent-2.1.12-stable/include'  /usr/bin/install -c -m 644 include/evdns.h include/event.h include/evhttp.h include/evrpc.h include/evutil.h '/usr/local/memcached/libevent-2.1.12-stable/include' /usr/bin/install: `include/evdns.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evdns.h' are the same file /usr/bin/install: `include/event.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/event.h' are the same file /usr/bin/install: `include/evhttp.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evhttp.h' are the same file /usr/bin/install: `include/evrpc.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evrpc.h' are the same file /usr/bin/install: `include/evutil.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evutil.h' are the same file make[2]: *** [install-includeHEADERS] Error 1 make[2]: Leaving directory `/usr/local/memcached/libevent-2.1.12-stable' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/usr/local/memcached/libevent-2.1.12-stable' make: *** [install] Error 2     使用 sudo make install 也是同样的错误

MongoDB的文档存储是指什么?

mongodb是key-value的存储方式,和redis一样,它们的value支持多种数据类型。怎么理解MongoDB的文档存储,是指它可以直接存word文档或者是Excel、图片这些吗?不像mysql存的是它们所在的路径。看了一下MongoDB和redis的简介,感觉MongoDB能够做的,redis也一样可以做。为什么有些场景要选MongoDB。比如:需要实时显示数据,两者都可以做到。 是我对它们理解的还不够透彻吗。

大数据量下如何存储用户点赞信息?

例如新浪微博的点赞系统,点赞一条微博之后不能重复点赞,那么实现这一功能必然要将用户id存储起来。面对新浪微博这样的大数据量,该如何存储点赞信息呢?我实验了一下,新浪微博几年前的微博依然不可以重复点赞,这样看起来的话,新浪微博应当是永久存储了用户信息。 有没有什么好的方案设计呢?

Memcached::get()could not unserialize value, no igbinary support

使用laravel Cache::get()时报错,版本PHP7 ,报错文件 vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php 已安装igbinary扩展 #php -m|grep igbinary igbinary 更新,重新安装memcached,3.x版本是支持php7的,而php5.2-5.6需要使用2.x版本 $ wget https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/v3.1.3 $ tar -zxvf php-memcached-3.1.3.tar.gz $ cd php-memcached-3.1.3 $/php7/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 $ ./configure –enable-memcached –enable-memcached-igbinary –with-php-config=/php7/bin/php-config $ make && make install Build complete. Don’t forget to run ‘make test’. Installing shared extensions: /php7/lib/php/extensions/no-debug-zts-20151012/ $ php7 –ini Configuration File (php.ini) Path: /php7/etc/ Loaded Configuration File: /php7/etc/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) $ vi /php7/etc/php.ini extension=memcache.so extension=/php7/lib/php/extensions/no-debug-zts-20151012/memcached.so 安装igbinary #wget http://pecl.php.net/get/igbinary-2.0.8.tgz #tar -zxvf igbinary-2.0.8.tgz # cd igbinary-2.0.8 # /php7/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 # ./configure –with-php-config=/php7/bin/php-config #make && make install Build complete. Don’t forget to run ‘make test’. Installing shared extensions: /php7/lib/php/extensions/no-debug-zts-20151012/ Installing header files: /php7/include/php/ 参考http://www.runoob.com/memcached/php-connect-memcached.html php-memcached扩展安装

[Session/Cookie] session配置为memcached或redis后的错误提示?

配置文件: $config[‘sess_driver’] = ‘memcached’;$config[‘sess_cookie_name’] = ‘caiwu’;$config[‘sess_expiration’] = 604800;$config[‘sess_save_path’] = ‘localhost:11211’;$config[‘sess_match_ip’] = FALSE;$config[‘sess_time_to_update’] = 300; 配置后运行日志有大量如下错误:ERROR – 2018-02-22 12:05:26 –> Session: Unable to obtain lock for ci_session:gb2ikrdgi9lravrtoad49ehv12k6e912 after 30 attempts, aborting.ERROR – 2018-02-22 12:05:27 –> Severity: Warning –> Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (localhost:11211) Unknown 0

MongoDB的文档存储是指什么?

mongodb是key-value的存储方式,和redis一样,它们的value支持多种数据类型。怎么理解MongoDB的文档存储,是指它可以直接存word文档或者是Excel、图片这些吗?不像mysql存的是它们所在的路径。看了一下MongoDB和redis的简介,感觉MongoDB能够做的,redis也一样可以做。为什么有些场景要选MongoDB。比如:需要实时显示数据,两者都可以做到。 是我对它们理解的还不够透彻吗。

Redis Watch Command

redis 中 关于 watch 命令的介绍: WATCH key [key …] summary: Watch the given keys to determine execution of the MULTI/EXEC block `观察给定的 keys 来决定 MULTI/EXEC 块是否执行` since: 2.2.0 group: transactions `自己的理解:在 MULTI/EXEC 块执行之前会判断 被 watch 的keys的值是否改变,如果都没改变则执行MULTI/EXEC 块` 下面的代码实现自增功能 def incr($key) WATCH $key `观察$key的值,如果没有改变就执行下面 MULTI/EXEC 块,来保证逻辑正确性` $value = GET $key if not $value $value = 0 $value = $value + 1 MULTI SET $key $value result = EXEC return result[0] `在 MULT/EXEC块中无法获取某个KEY的返回值,此时可以通过WATCH来实现同样的效果` 如果代码写成这样会有什么后果? def incr($key) $value = GET $key if not $value $value = 0 $value = $value + 1 return SET $key $value redis-cli中验证改变Watch key的值, MULTI/EXEC是否执行 127.0.0.1:6379> WATCH key1 OK 127.0.0.1:6379> SET key1 value1 OK 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> SET key2 value2 QUEUED 127.0.0.1:6379> SET key3 value3 QUEUED 127.0.0.1:6379> EXEC (nil) 127.0.0.1:6379> GET key2 (nil) 127.0.0.1:6379> GET key3 (nil) 既然都看到这里了,期望在下面看到你的见解.

redis一般是在什么情况下使用,它会不会与后台的数据库比如Sqlserver打交道?能否举例具体使用场景?

这两天在学习redis,心中有个疑问。1.redis一般是在什么情况下使用,它会不会与后台的数据库比如SQLServer打交道,如果要,怎么交互?2.redis的数据一般是不是就是存储一些网页里的键值对。还是说它只是一种缓存机制,需要定时的往后台真实数据库(比如SQLServer)里保存数据?3.和redis交互一般通过什么语言?4.能否举一个具体的例子,说明一下redis的使用场景。

php 一直报session写入失败

Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: tcp://127.0.0.1:6379) in /var/www/html/php/libs/util/Session.php on line 43 问题描述 我的代码写入session 的时候一直报这个问题, 环境是windows10 ubuntu 子系统,session 写入的位置是 memcache 6379 端口,扩展都开启了,有大神能解答一下这是什么问题吗? 问题出现的环境背景及自己尝试过哪些方法 相关代码 class Session { // single ton private static $session_handler_; public static function Init() { if (!isset(self::$session_handler_)) self::$session_handler_ = new Session(); } // 阻止用户复制对象实例 public function __clone() { trigger_error(‘Clone Session is not allowed.’, E_USER_ERROR); } private function __construct() { session_set_save_handler(array($this, “Open”), array($this, “Close”), array($this, “Read”), array($this, “Write”), array($this, “Destroy”), array($this, “Gc”)); // for web user $session_id = Cookie::Get(SESSIONID); /* length of session id 128-bit digest (MD5) 4 bits/char: 32 char SID 5 bits/char: 26 char SID 6 bits/char: 22 char SID 160-bit digest (SHA-1) 4 bits/char: 40 char SID 5 bits/char: 32 char SID 6 bits/char: 27 char SID */ if (!empty($session_id) && 26 == strlen($session_id)) session_id($session_id); session_start(); } public function __destruct() { session_write_close(); } public function Open($save_path, $session_name) { return true; } public function Close() { return true; } public function Read($session_id) { $key = SESSION_PREFIX . $session_id; $memcached_client_ = SessionMemCachedClient::GetInstance(); return (string)$memcached_client_->get($key); } public function Write($session_id, $data) { $key = SESSION_PREFIX . $session_id; $memcached_client_ = SessionMemCachedClient::GetInstance(); if ($data) return $memcached_client_->set($key, $data, SESSION_EXPIRE_TIME); return true; } public function Destroy($session_id) { $key = SESSION_PREFIX . $session_id; $memcached_client_ = SessionMemCachedClient::GetInstance(); return $memcached_client_->delete($key); } public function Gc($maxlifetime) { return true; } } Session::Init(); 你期待的结果是什么?实际看到的错误信息又是什么?

Redis Pipeline python

问题 简介: 以下代码来自 redis实战 一书中某个小节; 代码是python实现,其中如果pipeline()不加任何参数,或者是pipeline(True)的形式,那么客户端将使用MULTI EXEC包裹起来用户要执行的所有命令. 我的问题是: 既然pipeline(True) 实际将 要被执行的代码用MULTI EXEC包括起来 那么下面代码先不考虑业务,pipeline执行的时候会用MULTI EXEC包裹那些代码? // // 释放所的操作 // conn: 连接 // lockname: 锁的名字 // identify: 锁的Value值(128位) def release_lock(conn,lockname,identify): pipe = conn.pipeline(True) //Pipeline 执行的时候用MULTI EXEC包含那些代码? lockname = ‘lock’ + lockname while True: try: pipe.watch(lockname) if pipe.get(lockname) == identify: pipe.multi() pipe.delete(lockname) pipe.execute() return True pipe.unwatch() break except redis.exceptions.WatchError: pass return False 修改代码 pipeline(False) 含义是:客户端将向 事务那样把所有要执行的命令收集起来, 只是不会把这些命令用 MULTI EXEC 包裹起来. 那么上面的的pipeline 能写成 pipeline(False) 么,基于上面已经有写pipe.multi 期待的结果 给出伪代码 Or 说说你的理解. 故事与它;企鹅TUX,土拨鼠,海豚

Redis Watch Command

redis 中 关于 watch 命令的介绍: WATCH key [key …] summary: Watch the given keys to determine execution of the MULTI/EXEC block `观察给定的 keys 来决定 MULTI/EXEC 块是否执行` since: 2.2.0 group: transactions `自己的理解:在 MULTI/EXEC 块执行之前会判断 被 watch 的keys的值是否改变,如果都没改变则执行MULTI/EXEC 块` 下面的代码实现自增功能 def incr($key) WATCH $key `观察$key的值,如果没有改变就执行下面 MULTI/EXEC 块,来保证逻辑正确性` $value = GET $key if not $value $value = 0 $value = $value + 1 MULTI SET $key $value result = EXEC return result[0] `在 MULT/EXEC块中无法获取某个KEY的返回值,此时可以通过WATCH来实现同样的效果` 如果代码写成这样会有什么后果? def incr($key) $value = GET $key if not $value $value = 0 $value = $value + 1 return SET $key $value redis-cli中验证改变Watch key的值, MULTI/EXEC是否执行 127.0.0.1:6379> WATCH key1 OK 127.0.0.1:6379> SET key1 value1 OK 127.0.0.1:6379> MULTI OK 127.0.0.1:6379> SET key2 value2 QUEUED 127.0.0.1:6379> SET key3 value3 QUEUED 127.0.0.1:6379> EXEC (nil) 127.0.0.1:6379> GET key2 (nil) 127.0.0.1:6379> GET key3 (nil) 既然都看到这里了,期望在下面看到你的见解.

大数据量下如何存储用户点赞信息?

例如新浪微博的点赞系统,点赞一条微博之后不能重复点赞,那么实现这一功能必然要将用户id存储起来。面对新浪微博这样的大数据量,该如何存储点赞信息呢?我实验了一下,新浪微博几年前的微博依然不可以重复点赞,这样看起来的话,新浪微博应当是永久存储了用户信息。 有没有什么好的方案设计呢?

Memcached::get()could not unserialize value, no igbinary support

使用laravel Cache::get()时报错,版本PHP7 ,报错文件 vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php 已安装igbinary扩展 #php -m|grep igbinary igbinary 更新,重新安装memcached,3.x版本是支持php7的,而php5.2-5.6需要使用2.x版本 $ wget https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/v3.1.3 $ tar -zxvf php-memcached-3.1.3.tar.gz $ cd php-memcached-3.1.3 $/php7/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 $ ./configure –enable-memcached –enable-memcached-igbinary –with-php-config=/php7/bin/php-config $ make && make install Build complete. Don’t forget to run ‘make test’. Installing shared extensions: /php7/lib/php/extensions/no-debug-zts-20151012/ $ php7 –ini Configuration File (php.ini) Path: /php7/etc/ Loaded Configuration File: /php7/etc/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) $ vi /php7/etc/php.ini extension=memcache.so extension=/php7/lib/php/extensions/no-debug-zts-20151012/memcached.so 安装igbinary #wget http://pecl.php.net/get/igbinary-2.0.8.tgz #tar -zxvf igbinary-2.0.8.tgz # cd igbinary-2.0.8 # /php7/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 # ./configure –with-php-config=/php7/bin/php-config #make && make install Build complete. Don’t forget to run ‘make test’. Installing shared extensions: /php7/lib/php/extensions/no-debug-zts-20151012/ Installing header files: /php7/include/php/ 参考http://www.runoob.com/memcached/php-connect-memcached.html php-memcached扩展安装

MongoDB的文档存储是指什么?

mongodb是key-value的存储方式,和redis一样,它们的value支持多种数据类型。怎么理解MongoDB的文档存储,是指它可以直接存word文档或者是Excel、图片这些吗?不像mysql存的是它们所在的路径。看了一下MongoDB和redis的简介,感觉MongoDB能够做的,redis也一样可以做。为什么有些场景要选MongoDB。比如:需要实时显示数据,两者都可以做到。 是我对它们理解的还不够透彻吗。

[Session/Cookie] session配置为memcached或redis后的错误提示?

配置文件: $config[‘sess_driver’] = ‘memcached’;$config[‘sess_cookie_name’] = ‘caiwu’;$config[‘sess_expiration’] = 604800;$config[‘sess_save_path’] = ‘localhost:11211’;$config[‘sess_match_ip’] = FALSE;$config[‘sess_time_to_update’] = 300; 配置后运行日志有大量如下错误:ERROR – 2018-02-22 12:05:26 –> Session: Unable to obtain lock for ci_session:gb2ikrdgi9lravrtoad49ehv12k6e912 after 30 attempts, aborting.ERROR – 2018-02-22 12:05:27 –> Severity: Warning –> Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (localhost:11211) Unknown 0

redis一般是在什么情况下使用,它会不会与后台的数据库比如Sqlserver打交道?能否举例具体使用场景?

这两天在学习redis,心中有个疑问。1.redis一般是在什么情况下使用,它会不会与后台的数据库比如SQLServer打交道,如果要,怎么交互?2.redis的数据一般是不是就是存储一些网页里的键值对。还是说它只是一种缓存机制,需要定时的往后台真实数据库(比如SQLServer)里保存数据?3.和redis交互一般通过什么语言?4.能否举一个具体的例子,说明一下redis的使用场景。

1G的memcached怎么知道可以存放多少数据量不丢失?

我有一张表有26378条数据,每条数据的格式都大致是这样的:{“p_name”:”u534eu6d3eu7167u660eLEDu5c0fu53f0u706f(u767du8272)”,”price”:”100.00″,”pid”:”864edc6310bf1bd7e6c7ed938ad4b7e4″,”uid”:”e00401506b974a05″} 存储格式:$m->set(“e00401506b974a05”,{“p_name”:”u534eu6d3eu7167u660eLEDu5c0fu53f0u706f(u767du8272)”,”price”:”100.00″,”pid”:”864edc6310bf1bd7e6c7ed938ad4b7e4″,”uid”:”e00401506b974a05″},0); 然后我一直担心就是memcached分配的slab内存对应的chunk块存储数据内存不够导致数据丢失或覆盖的问题,所以想问关于1G的memached缓存是不是有多少就可以放多少?想把整个数据库的2万多条数据放进去可能吗? (疑问:总的数据库数据就60多M,就算存整个数据库数据进memcached应该也占用不到1G吧?)

多表关联如何使用memcached提高访问速度?

想在多表连接里面接入memcached减少访问数据库提高访问速度,但是关键的是有一张cash表竟然是动态的导致不知道怎么样才能接入memcached了。 功能:通过cash表动态的根据uid去找uid表的pid,再通过pid去找products表。 如果通过三表连接可以很快找出商品,但是想通过缓存(memcached)来提高加载速度,减少数据库的请求。想问下应该如何解决这个问题?谢谢了。【具体看图:】

如何实现本地开发远程使用memcached和数据库连接的方法?

我是新手,第一次学习memcached,然后想实现这样的功能:(想问下可以实现吗)一台服务器专门放memcached,一台服务器是数据库(只读数据库),还有一台是专门放代码的服务器。然后专门放代码的服务器去从数据库服务器读数据出来然后缓存数据放memcached的服务器里,当用户访问代码的服务器的时候第一次是从数据库取数据并缓存到memcached,然后当第二次访问的时候可以不读数据库而是从memcached取缓存的数据。 想问下这个功能可以实现的吗?如果不能实现,那memcached和数据库还有代码是怎么实现缓存数据功能的? 因为第一次做这个,另外想了解下实际开发过程中一般是怎么实现数据库和缓存功能的实现的? 希望大神可以给点经验方法,谢谢分享。

php登录导致的session丢失

描述: 简单的说就是在登录页面ajax调用php的api登录后前端跳转。 问题: 在chrome浏览器下,有时候登录session会丢失,但打了log发现每次调用api都能set到session。session是存储在memcache里面的,在多次登录后再次快速点击登录按钮就发现session没设置到,很奇怪。 在overflow很多人都提到facvicon.ico的问题,调试了发现也不是这个原因。 之前在js做了一个延时2秒跳转起到作用,但现在又不行,刚刚在php脚本set完session后return之前加了sleep延时2秒,又起到作用,真搞不懂是什么原因了。 环境是测试环境,就一台服务器,不是多服务器共享session,当然线上是,线上也有这个问题。 关于存储memcache的,每次点登录后session失效都去查过memcache,确实没有这些数据,正常登录后又有数据,如果是php存储到memcache的问题,又要怎么去调试和解决? 还有关于window.location.href这个的问题,也有人提到这个方法会重启一个httpcontext导致session丢失的问题,这里也很奇怪,我在调登录api后在ajax里打了断点,阻止window.location.href跳转,然后在另外的页面访问输出session,有时候有session,但跳转之后就没了,但有时候也没有。 问题描述大概就是以上,有的话再补充!!!

关于PHP抢购访问数据库压力问题

现在有一个商品抢购项目,大概1000种的商品,根据商品类型,在手机微信端展示商品列表(一个类别中大概100种商品)在活动开始后,有两千人来抢购,(同时进来抢购)商品的列表,我的收藏,商品详情这些内容可能会被频繁访问,现在如果只是访问数据库来操作,不使用缓存的话,一般情况下服务器 和 数据库访问压力会不会过大? 这种情况一般都是怎么来做的?这方面没有经验,也没有测试手段。有经验的各位,能不能说一下自己的心得

php 如何用session_id 获取指定session?

业务场景,公司老项目,与客户端的会话连接用sessionid 搭建的。现在要做一个顶号踢下线的功能 1.建立相关数据表,记录用户的sessionid, uid, 在线状态2.当用户在其他客户端登录同一账号时,更改数据库,将上次登录的session 注销掉 代码构思如下: $presid = session_id(); $othersid = session_id(‘soupivi4v3qhkfj2vjennnsbt6’); 这两个sessionid 拿到的值都是一样的?请教,why? 我知道应该用JWT做,but,老项目, 现在是session。

在django设置使用memcached困惑?

系统环境:window是不是需要window安装了memcached才可以正常使用? 1.我按照django官方描述中在setting.py添加了以下代码: CACHES = { ‘default’: { ‘BACKEND’: ‘django.core.cache.backends.memcached.MemcachedCache’, ‘LOCATION’: ‘127.0.0.1:11211’, } } 然后直接在shell中执行语句 In [1]: from django.core.cache import cache In [2]: cache.set(‘my_key’,’hello,world’,20) In [3]: print cache.get(‘my_key’) None 如果我在setting.py中添加一下代码 CACHES = { ‘default’: { ‘BACKEND’: ‘django.core.cache.backends.locmem.LocMemCache’, ‘LOCATION’: ‘unique-snowflake’, } } 就可以正常使用,请问怎么才可以正确使用django的缓存功能??

Memcached在win7上安装报错?Failed to ignore SIGHUP Result too large

 在win7 64 位上安装memcached报错,在这里下载的 http://downloads.northscale.c… 报错信息:Failed to ignore SIGHUP: Result too large 已经执行过:`sc create “Memcached11211” binPath= “D:memcachedmemcached.exe -d runservice -p 11211” DisplayName= “Memcached11211” start= auto`和 sc create memcached binPath= D:\memcached\memcached.exe s tart= auto 还是报上面那个错误,请问怎么回事?谢谢

thinkphp使用memcached不定时的卡死

系统环境为:win2008+iis7+php+mysql 程序使用:thinkphp3.2.3,使用memcached存储session 平时低访问量的时候一直没问题,最近在搞活动访问量增大,日访问量大约10万UV 于是大概12小时左右会卡死一次,输入stats是没有反映的 session也无法再读写,并造成mysql的sleep增多CPU窜致100% 将memcached重新stop、start后一切正常 哪位高手可否指教一下可能存在什么原因造成的? 另外memcached的启动已设置为:“memcached.exe” -m 3000 -c 30720 -d runservice 贴上正常状态下的stats信息: statsSTAT pid 2316STAT uptime 3054545921STAT time 258961769STAT version 1.4.4-14-g9c660c0STAT pointer_size 64STAT curr_connections 30STAT total_connections 46STAT connection_structures 31STAT cmd_get 129846STAT cmd_set 129843STAT cmd_flush 0STAT get_hits 110380STAT get_misses 19466STAT delete_misses 0STAT delete_hits 0STAT incr_misses 0STAT incr_hits 0STAT decr_misses 0STAT decr_hits 0STAT cas_misses 0STAT cas_hits 0STAT cas_badval 0STAT auth_cmds 0STAT auth_errors 0STAT bytes_read 20744786STAT bytes_written 15266762STAT limit_maxbytes 3145728000STAT accepting_conns 1STAT listen_disabled_num 0STAT threads 4STAT conn_yields 0STAT bytes 3171254STAT curr_items 19427STAT total_items 129843STAT evictions 0END

注册验证邮箱失效后操作问题

关于注册验证邮箱问题,我的思路是这样的: 在数据库中加入status字段记录邮箱验证状态,默认为未激活状态 给用户邮箱发送验证邮箱地址,用户点击后才可激活邮箱 若用户一定时间内未激活则删除用户数据 我的困惑在第三条(当然有其他地方歧义也可指出) 是否在未激活一段时间后暴力删除,这样不会没事吧?(这样做的方式是否欠妥当) [重点]删除数据的方法 删除数据的方法[问题] 我的思路是加入一个创建用户时间,然后根据用户创建时间和激活状态status删除数据,但是不知道具体思路是什么。 还有我不知道是用编程语言写逻辑删除还是用MySQL数据库写逻辑自动删除。 本人对NoSQL知之深浅,就是比较好奇此功能是否可以用NoSQL如redis,memcache实现,效果和mysql哪个好?

Memcache的使用方法和场景

memcache 的使用方法: 一个配置文件: 一个memcache的工具类 public final class MemcachedUtils{ /** * memcached客户端单例 */ private static MemCachedClient cachedClient = new MemCachedClient(); private MemcachedUtils(){ } public static boolean add(String key, Object value) { return cachedClient.add(key, value); } public static boolean add(String key, Object value, Integer expire) { return cachedClient.add(key, value, expire); } public static boolean put(String key, Object value) { return cachedClient.set(key, value); } public static boolean put(String key, Object value, Integer expire) { return cachedClient.set(key, value, expire); } public static boolean replace(String key, Object value) { return cachedClient.replace(key, value); } public static boolean replace(String key, Object value, Integer expire) { return cachedClient.replace(key, value, expire); } public static Object get(String key) { return cachedClient.get(key); } } 应用: 在service 的实现类使用 @Service public class StudentServiceImpl implements StudentService { @Resource private StudentMapper studentMapper; public List<Student> findGoodStudent() { List<Student> goodStudents; if(MemcachedUtils.get(“goodStudents”) != null){ goodStudents = (List<Student>) MemcachedUtils.get(“goodStudents”); System.out.println(“使用了memcache”); return goodStudents; } goodStudents = studentMapper.findGoodStudent(); System.out.println(“没有使用memcache”); MemcachedUtils.add(“goodStudents”,goodStudents); return goodStudents; } 这是我的使用方法,我想请教一下大佬们在实际工作中的使用场景和方法是如何做的???

java开发求一款memcached可视化工具

JAVA开发环境,memcached服务部署在远程LINUX服务器上.如图,目前使用的一款国产老哥开发的,直接和项目一同发布在tomcat服务器中,但是问题是其中显示缓存只有极少一部分,并不全.网上搜索了memadmin尝试配置了一下并不能用,还是有相同环境可以正常使用的老哥? 莫非是我配置的有问题?求指点!