Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CachePut skipping required fields

I want to use CachePut(). In particular, I want to

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

id, value, and region are the 1st, 2nd, and 5th parameters respectively.

Adobe says the 3rd through last parameters are optional. Source: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/CachePut.html

How do I pass in the 1st, 2nd, and 5th? When I try it, I get:

enter image description here

like image 471
James A Mohler Avatar asked Dec 17 '25 19:12

James A Mohler


1 Answers

FROM ABOVE COMMENTS:

CF2016 didn't do named parameters. That started with CF2018. So you'd have to take out the names and pass something in the 3rd and 4th position. Normally you can just pass the normal default values. I'm not sure what those are for this tag in CF2016, but the F2018 doc http://cfdownload.adobe.com/pub/adobe/coldfusion/2018/publicBeta/NamedParametersColdFusion2018.pdf seems to indicate the defaults are both empty strings.

Try

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

EXAMPLE:

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>
like image 144
Shawn Avatar answered Dec 20 '25 01:12

Shawn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!