打开/关闭菜单
331
1.7K
131
11.8K
星露谷物语扩展百科
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:Qualityprice:修订间差异

来自星露谷物语扩展百科
Sizau留言 | 贡献
created
 
Sizau留言 | 贡献
无编辑摘要
第6行: 第6行:
local function expandTemplate(args)
local function expandTemplate(args)
     return mw.getCurrentFrame():expandTemplate{
     return mw.getCurrentFrame():expandTemplate{
         title = 'Qualityprice/Base',
         title = '模板:Qualityprice/Base',
         args = {
         args = {
             args[1],
             args[1],
第23行: 第23行:
     if cache.get(cacheKey) then
     if cache.get(cacheKey) then
     local result = cache.get(cacheKey)
     local result = cache.get(cacheKey)
         return result
    cache.set(cacheKey, result, EXP_TIME)
         -- return result
     end
     end
     local result = expandTemplate(args)
     local result = expandTemplate(args)
    -- cache.set(cacheKey, result, EXP_TIME)
     cache.set(cacheKey, result, EXP_TIME)
     cache.set(cacheKey, result, EXP_TIME)
     return result
     return result

2024年11月19日 (二) 14:00的版本

[ 创建 | 刷新 ]文档页面
当前模块文档缺失,需要扩充。
local cache = require "mw.ext.LuaCache"
local KEY_PREFIX = "Module:Qualityprice"
local EXP_TIME = 172800
local p = {}

local function expandTemplate(args)
    return mw.getCurrentFrame():expandTemplate{
        title = '模板:Qualityprice/Base',
        args = {
            args[1],
            args[2],
            pm = args['pm'] or "",
            dsv = args['dsv'] or "",
            hide = args['hide'] or "",
            quality = args['quality'] or "",
        }
    }
end

function p.render(frame)
    local args = frame.args
    local cacheKey = KEY_PREFIX .. "|" .. args[1] .. "|" .. args[2] .. "|" .. (args['pm'] or "") .. "|" .. (args['dsv'] or "").. "|" .. (args['hide'] or "").. "|" .. (args['quality'] or "")
    if cache.get(cacheKey) then
    	local result = cache.get(cacheKey)
    	cache.set(cacheKey, result, EXP_TIME)
        -- return result
    end
    local result = expandTemplate(args)
    -- cache.set(cacheKey, result, EXP_TIME)
    cache.set(cacheKey, result, EXP_TIME)
    return result
end

return p