Software / code / prosody
Comparison
plugins/mod_smacks.lua @ 11976:10cdfb94f1cc
mod_smacks: Remove dead legacy code for 0.10
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 01 Dec 2021 15:27:55 +0100 |
| parent | 11975:fcea4d9e7502 |
| child | 11977:9f7a6f7d13de |
comparison
equal
deleted
inserted
replaced
| 11975:fcea4d9e7502 | 11976:10cdfb94f1cc |
|---|---|
| 49 assert(max_old_sessions > 0, "smacks_max_old_sessions must be greater than 0"); | 49 assert(max_old_sessions > 0, "smacks_max_old_sessions must be greater than 0"); |
| 50 | 50 |
| 51 local c2s_sessions = module:shared("/*/c2s/sessions"); | 51 local c2s_sessions = module:shared("/*/c2s/sessions"); |
| 52 | 52 |
| 53 local function init_session_cache(max_entries, evict_callback) | 53 local function init_session_cache(max_entries, evict_callback) |
| 54 -- old prosody version < 0.10 (no limiting at all!) | |
| 55 if not cache then | |
| 56 local store = {}; | |
| 57 return { | |
| 58 get = function(user, key) | |
| 59 if not user then return nil; end | |
| 60 if not key then return nil; end | |
| 61 return store[key]; | |
| 62 end; | |
| 63 set = function(user, key, value) | |
| 64 if not user then return nil; end | |
| 65 if not key then return nil; end | |
| 66 store[key] = value; | |
| 67 end; | |
| 68 }; | |
| 69 end | |
| 70 | |
| 71 -- use per user limited cache for prosody >= 0.10 | 54 -- use per user limited cache for prosody >= 0.10 |
| 72 local stores = {}; | 55 local stores = {}; |
| 73 return { | 56 return { |
| 74 get = function(user, key) | 57 get = function(user, key) |
| 75 if not user then return nil; end | 58 if not user then return nil; end |