diff options
| author | ruki <[email protected]> | 2020-12-19 21:41:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-19 21:41:41 +0800 |
| commit | db86f1dfa99279e12cc750e084f8d17d68543579 (patch) | |
| tree | 4b32040e0e8c255f392ab4b4d80a7f7ea17579f6 | |
| parent | ff4f482606197b3e1a5dd94cded73b7b1c889d0d (diff) | |
export memcache
| -rw-r--r-- | xmake/core/cache/memcache.lua | 7 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/cache/memcache.lua | 23 |
2 files changed, 27 insertions, 3 deletions
diff --git a/xmake/core/cache/memcache.lua b/xmake/core/cache/memcache.lua index 36e462569..c83089e1d 100644 --- a/xmake/core/cache/memcache.lua +++ b/xmake/core/cache/memcache.lua @@ -19,7 +19,8 @@ -- -- define module: memcache -local memcache = memcache or {} +local memcache = memcache or {} +local _instance = _instance or {} -- load modules local table = require("base/table") @@ -91,7 +92,7 @@ end -- -- @code -- memcache.clear() -- clear all caches --- memcache.clear("cachescope.") -- clear caches with `cachescope.*` +-- memcache.clear("cachescope") -- clear caches with `cachescope.*` -- @endcode -- function memcache.clear(scopename) @@ -99,7 +100,7 @@ function memcache.clear(scopename) if caches then for _, cache in pairs(caches) do if scopename then - if cache:startswith(scopename) then + if cache:name():startswith(scopename .. ".") then cache:clear() end else diff --git a/xmake/core/sandbox/modules/import/core/cache/memcache.lua b/xmake/core/sandbox/modules/import/core/cache/memcache.lua new file mode 100644 index 000000000..5b975f8ac --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/cache/memcache.lua @@ -0,0 +1,23 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file memcache.lua +-- + +-- return module +return require("cache/memcache") + |
