User caching happens in threadlocal as well as cache

Description

User data is cached in both threadlocal and the callCache cache. It really should only be cached in the cache. Use of threadlocals for caching is a bad idea and should no longer be done. This is especially interesting because the threadlocal can win over the cache so if the cache is updated or expired so that the user data would be valid, the threadlocal version would still be used (which may be stale).

protected UserEdit getCachedUser(String ref)
{
UserEdit user = (UserEdit)threadLocalManager().get(ref);
if ((user == null) && (m_callCache != null))
{
user = (UserEdit)m_callCache.get(ref);
}
return user;
}

protected void putCachedUser(String ref, UserEdit user)
{
threadLocalManager().set(ref, user);
if (m_callCache != null) m_callCache.put(ref, user);
}

protected void removeCachedUser(String ref)
{
threadLocalManager().set(ref, null);
if (m_callCache != null) m_callCache.remove(ref);
}

Attachments

1

Activity

Show:

Robert Long February 13, 2015 at 10:28 AM

Not sure there's really a way to verify this via the UI... You can look at the code and note that all the threadlocal stuff is removed, I guess!

--Bob

Neal Caidin February 12, 2015 at 7:41 PM

How can this be verified?

Matthew Buckett January 5, 2015 at 6:37 AM
Edited

Thanks Bob. Commit is in master now.

Robert Long December 31, 2014 at 8:53 AM

Submitted a pull request.

Robert Long October 30, 2014 at 10:58 AM

I don't see why not... I'll update the patch when I get a moment.

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created April 23, 2014 at 6:57 AM
Updated April 25, 2018 at 3:19 PM
Resolved January 5, 2015 at 6:37 AM