Sure. A CacheStorage that doesn't mark itself as thread-safe must be synchronized by the called. Those who do mark themselves as thread-safe do the synchronization themselves, but internally, somewhere, they will still use synchronized.
So the question is the synchronization of MruCacheStorage a bottleneck in your app? I mean, those synchronized operations should complete really quick. They don't do anything heavy, like loading and parsing templates.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As far as I don't see that it's a bottleneck in reality (and I doubt that it can be), there are much better places to invest developer time. Resources for developing FreeMarker are rather sparse. I would close this issue, if there's nothing more to it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As far as I know (I'm not the author of that code), it's pretty much designed for many-thread access. What exactly is the issue?
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
MruCacheStorage implements CacheStorage
SoftCacheStorage implements ConcurrentCacheStorage
StrongCacheStorage implements ConcurrentCacheStorage
MruCacheStorage is not concurrent,it will synchronize threads
in TemplateCache:
CachedTemplate cachedTemplate;
if(isStorageConcurrent) { cachedTemplate = (CachedTemplate)storage.get(tk); }
else {
synchronized(storage) { cachedTemplate = (CachedTemplate)storage.get(tk); }
}
Last edit: Anonymous 2017-06-17
Sure. A CacheStorage that doesn't mark itself as thread-safe must be synchronized by the called. Those who do mark themselves as thread-safe do the synchronization themselves, but internally, somewhere, they will still use synchronized.
So the question is the synchronization of MruCacheStorage a bottleneck in your app? I mean, those synchronized operations should complete really quick. They don't do anything heavy, like loading and parsing templates.
I meant: A CacheStorage that doesn't mark itself as thread-safe must be
synchronized by the calleR.
MruCacheStorage is thread-safe also,but it's not concurrent (using java.util.concurrent) like SoftCacheStorage
In large scale application,it could be a bottleneck,if you can keep backward compatible and boost performance,why not?
As far as I don't see that it's a bottleneck in reality (and I doubt that it can be), there are much better places to invest developer time. Resources for developing FreeMarker are rather sparse. I would close this issue, if there's nothing more to it.