diff --git a/app/libs/util/redis.rb b/app/libs/util/redis.rb new file mode 100644 index 000000000..f240406f5 --- /dev/null +++ b/app/libs/util/redis.rb @@ -0,0 +1,9 @@ +module Util::Redis + class << self + def online_user_count + if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore) + Rails.cache.data.scan(0, match: 'cache:_session_id:*', count: 100000).last.uniq.size + end + end + end +end \ No newline at end of file