[
https://issues.apache.org/jira/browse/DIRECTMEMORY-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13575566#comment-13575566
]
Jaromir Hamala commented on DIRECTMEMORY-31:
--------------------------------------------
Hi, I pushed a very first version to
https://github.com/jerrinot/directmemory/tree/DIRECTMEMORY-31
I would appreciate if a member of team could look at it. I saw there were some
(unused) old classes to support configuration. I kept the format options
(yaml+properties), but didn't re-use much of the code. It seemed to be very
"singleton-orientated".
The Idea is that CacheManager serves as cache (CacheService) factory.
DefaultCacheManager is is currently the only implementation. It can receive an
instance DirectMemoryConfiguration in its constructor or it can use a default
configuration when non-args constructor is used.
DirectMemoryConfiguration can be obtained from a factory. Currently there are
property-based and yaml-based implementation. I want to implement a
factory/builder with a fluent interface - for programmatic configuration.
It's not nearly complete, it misses at least these features:
- a proper test coverage - I'm not sure if the current version even work! I
pushed it to a github to have a chance for an early feedback.
- JavaDoc
- implementation of FluentDirectMemoryConfigurationFactory
- implementation of XMLDirectMemoryConfigurationFactory
- configuration should be based on convetions + inheritance from Default cache
- format of Yaml configuration file is tightly couple to an internal structure
of DirectMemoryConfiguration. I took this from the original configuration
implementation, but I do not like the idea.
My other ideas/concerns:
- I'm not sure if configuration should be in a separate module (common) I see
no reason for this
- I'm not sure if DirectMemory should be part of the public API. The end use
should use CacheManager to obtain caches
- I do not quite understand the OSGi stuff. I had to remove explicit
!org.apache.directmemory* from the directmemory-cache module to be able to use
classes from common module
- I would consider to rename CacheService to just Cache. It's custom in other
caching libraries + it's in line with JSR-107
> Cache configuration from config file
> ------------------------------------
>
> Key: DIRECTMEMORY-31
> URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-31
> Project: Apache DirectMemory
> Issue Type: New Feature
> Reporter: Igor Babalich
>
> Cache manager looks for 'directmemory.config.file' system property.
> If it is found, it will use that file for instantiation of the caches.
> The config file could be like this ( groovy config file ):
> -----------------------------------------------------------
> version=1
> cache {
> photos {
> numberOfBuffers=10
> bufferSize="5 Mb"
> timeToLive="24 hours"
> }
> users {
> numberOfBuffers=2
> bufferSize=1000000
> timeToLive="60 minutes"
> timeToIdle="20 minutes"
> }
> }
> ------------------------------------------------------------
> If 'directmemory.config.file' system property is not found then cache manager
> will report a warning in the logfile and
> try to find a default configuration file in the classpath with the name
> 'directmemory_config.groovy'
> Caches can be also initialized by providing a parameter to the cache manager
> with the configuration file's path, like
> CacheManager.init('/path/to/config/mycache_config.groovy')
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira