View Issue Details

IDProjectCategoryView StatusLast Update
0020551mantisbtcode cleanuppublic2016-08-28 01:12
Reportervboctor Assigned Toatrol  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.3.0-rc.1 
Target Version1.3.1Fixed in Version1.3.1 
Summary0020551: Why does user_cache_database_result() return cache value?
Description

This method is called to put rows into the cache? Why does it check for the row in the cache and return it? I would have expected it to always update the row and not return it, just have a void return.

Currently if the passed row is newer than the one in the cache, the cache will maintain the old one which is now stale.

Probably not a huge deal since the request will be stale for this just single request, but it is not right.

TagsNo tags attached.

Activities

cproensa

cproensa

2016-01-29 14:04

developer   ~0052444

sometimes i think a more structured cache (not just random global vars) may be a benefit.
I got to think about it when we cache info regardless of access controls, sometimes its different "as seen from a reporter", than it's to core system functionality.
Sometimes we would want to perform operations with contolled/disabled cache (mass treatment of data, one pass)
...etc

dregad

dregad

2016-01-30 19:15

developer   ~0052451

I had a quick look, and it appears that user_cache_database_result() is only called after user_search_cache() failed to return anything, which implies that the cache is not set for the record being added.

That being said, I don't see the rationale behind the function's current behavior either.

atrol

atrol

2016-08-22 15:02

developer   ~0053879

Last edited: 2016-08-22 15:12

I stumbled too often over this function and did not understand what it does.

PR https://github.com/mantisbt/mantisbt/pull/866

Related Changesets

MantisBT: master-1.3.x 694873e7

2016-08-22 10:56

atrol


Details Diff
Cache latest data in function user_cache_database_result

The functions did not return a value in all cases.
There is no place in code where the return value of the function is used.

The cache was not updated with latest data if's been set before.

Fixes 0020551
Affected Issues
0020551
mod - core/user_api.php Diff File