Skip to content

Commit

Permalink
Cache policies LRU error (#590)
Browse files Browse the repository at this point in the history
COLDBOX-1280 https://ortussolutions.atlassian.net/browse/COLDBOX-1280 #Resolve


* check if md keys exist before referencing
Fixes error:
Error sorting via store indexer Element TIMEOUT is undefined in MD. coldfusion.runtime.UndefinedElementException: Element
TIMEOUT is undefined in MD.

* Add default value if missing
Fixes error:
Error sorting via store indexer Invalid property requested: isSoftReference Valid properties are: coldfusion.runtime.CustomException:
Invalid property requested: isSoftReference
  • Loading branch information
aliaspooryorik authored and lmajano committed May 1, 2024
1 parent 7a360db commit 5fe203b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions system/cache/policies/AbstractEvictionPolicy.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ component
continue;
}
var md = indexer.getObjectMetadata( item );
if ( NOT md.keyExists( "timeout" ) || NOT md.keyExists( "isExpired" ) ) {
continue;
}

// Evict if not already marked for eviction or an eternal object.
if ( md.timeout GT 0 AND NOT md.isExpired ) {
Expand Down
3 changes: 2 additions & 1 deletion system/cache/store/ConcurrentSoftReferenceStore.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ component extends="coldbox.system.cache.store.ConcurrentStore" accessors=true {
if (
!isNull( local.softRef ) && variables.indexer.getObjectMetadataProperty(
arguments.objectKey,
"isSoftReference"
"isSoftReference",
false
)
) {
variables.softRefKeyMap.remove( softRef.hashCode() );
Expand Down

0 comments on commit 5fe203b

Please sign in to comment.