Ticket #777 (closed defect: fixed)
cache manager object keys need consistent trims
| Reported by: | lmajano | Owned by: | lmajano |
|---|---|---|---|
| Priority: | highest | Milestone: | 3.0.0 |
| Component: | ColdBox Cache | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The objectKey is trimmed before being used in the set method, but is not trimmed on the get, clearKey, or lookup method (and a couple others).
That means code like this will return unexpected results:
<cfset keyName = "foobar "><!--- Notice the trailing space ---> <cfset variables.cacheManager.set(keyName,"test",10)> #variables.cacheManager.lookup(keyName)#<br> #variables.cacheManager.get(keyName)#
Output: false _NOTFOUND_
I briefly looked through the docs and API and couldn't find any references to what a valid objectKey was allowed to be. Even if leading or trailing spaces are not permissible, it seems that the cacheManager shuold be consistent and always trim or never trim incoming objectKeys.
