framework
framework copied to clipboard
Use memcached cache driver
I use memcached server for the cache driver.But when the application run a long time(5 days ) the server will take so many TIME_WAIT connection ().Is the connection keepalive and How can I reset the connection or close the connection
netstat -atounlp | grep 'memcached ' | more
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 1729/memcached off (0.00/0/0)
tcp 0 0 192.168.1.21:11211 0.0.0.0:* LISTEN 1583/memcached off (0.00/0/0)
tcp 0 0 127.0.0.1:11211 127.0.0.1:55651 ESTABLISHED 1729/memcached keepalive (6890.79/0/0)
tcp 0 5 127.0.0.1:11211 127.0.0.1:37286 ESTABLISHED 1729/memcached on (0.17/0/0)
tcp 0 0 127.0.0.1:11211 127.0.0.1:54926 ESTABLISHED 1729/memcached keepalive (6011.89/0/0)
tcp 0 0 127.0.0.1:11211 127.0.0.1:47881 ESTABLISHED 1729/memcached keepalive (6634.08/0/0)
udp 0 0 127.0.0.1:11211 0.0.0.0:* 1729/memcached off (0.00/0/0)
udp 0 0 192.168.1.21:11211 0.0.0.0:* 1583/memcached off (0.00/0/0)
use code like Cache::put("key",value,timeout) Cache::remember()
Why cache in memory information for so long time? I suggest you to use another tool to cache your information. Perhaps use the file driver.
Continue this on the forums if need be.