计算活动会话 [英] Count active sessions

查看:130
本文介绍了计算活动会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用memcached存储会话.我正在寻找当前有多少活动会话.

I store my sessions with memcached. I am looking to detect how many active sessions there are currently.

我坚信这是有可能的-但我一直在Google和Google上搜索,但无济于事,所以请stackoverflowers给我一些指导:)

I am convinced it must be possible - But I have googled and googled but to no avail so please stackoverflowers give me some guidence :)

推荐答案

Memcached本质上不是要那样使用(它是一个短暂的缓存存储,它不打算像聚合查询一样执行SQL/数据库操作) ,并且当前的活动会话通常不是我不感兴趣的(出于负载目的,网络服务器的点击量和统计数据要重要得多).

Memcached by nature isn't meant to be used like that (it's a fleeting cache store, it is not intended to do SQL / database like aggregate queries over), and current active sessions is usually not something I am remotely interested in (for load purposes, the hits & statistical data of the webserver is much more to the point).

但是,如果您仅使用内存缓存 来存储会话数据(而不是其他键值对),则可以使用

If you are however use memcache only to store session-data (not other key-value pairs), you can use getStats() to get an item count (cur_items) on the current memcache server.

这篇关于计算活动会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆