CachePut 跳过必填字段

CachePut skipping required fields

我想使用 CachePut()。特别是,我想

 CachePut(id = _attr.path, value = attr.qryPath, region = variables.cacheRegion);

idvalueregion分别为第1、2、5个参数。

Adobe 表示第三个参数到最后一个参数是可选的。资料来源:https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/CachePut.html

第一、第二、第五如何通过?当我尝试时,我得到:

来自以上评论:

CF2016 没有做命名参数。那是从 CF2018 开始的。所以你必须取出名字并在第 3 和第 4 个位置传递一些东西。通常你可以只传递正常的默认值。我不确定 CF2016 中这个标签的那些是什么,但 F2018 文档 http://cfdownload.adobe.com/pub/adobe/coldfusion/2018/publicBeta/NamedParametersColdFusion2018.pdf 似乎表明默认值都是空字符串。

尝试

CachePut(_attr.path,attr.qryPath,"","",variables.cacheRegion) ;

示例:

https://cffiddle.org/app/file?filepath=a253f587-43fa-482f-b4cd-c7bbb8b45f3d/252b1e4b-d303-4a16-9d80-7c657e6e7770/7c0dc772-099c-4827-8e2f-068b2e32a4d8.cfm

<cfscript>
    attr.Path = "_path" ;
    attr.qryPath = "querypath" ;
    variables.cacheRegion = "newCacheRegion" ;

    CacheRegionNew(variables.cacheRegion);

    //WriteDump(CacheGetProperties(variables.cacheRegion));

    CachePut(attr.Path,attr.qryPath,"","",variables.cacheRegion);

    writeDump(CacheGet(attr.Path,variables.cacheRegion));
</cfscript>