The reason I am thinking you have to synch on every getCachedField call is that the cache needs to be lazily loaded...I don't see a way to do with this without sync unless you have an ugly "you must call this method before repeatably calling getCachedField."

Maybe I am wrong? Or maybe the cost of synchronization is low enough now not to matter as long as we provide the back compaitable way?

Michael McCandless (JIRA) wrote:
     [ 
https://issues.apache.org/jira/browse/LUCENE-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582576#action_12582576
 ]

Michael McCandless commented on LUCENE-831:
-------------------------------------------

I think if we can finally move to having read-only IndexReaders then they would 
not sync on this method?

Also, we should still provide the "give me the full array as of right now" 
fallback which in a read/write usage would allow you to spend lots of RAM in order to not 
synchronize.  Of course you'd also have to update your array (or, periodically ask for a 
new one) if you are altering fields.

Complete overhaul of FieldCache API/Implementation
--------------------------------------------------

                 Key: LUCENE-831
                 URL: https://issues.apache.org/jira/browse/LUCENE-831
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Search
            Reporter: Hoss Man
            Assignee: Michael Busch
             Fix For: 2.4

         Attachments: fieldcache-overhaul.032208.diff, 
fieldcache-overhaul.diff, fieldcache-overhaul.diff


Motivation:
1) Complete overhaul the API/implementation of "FieldCache" type things...
     a) eliminate global static map keyed on IndexReader (thus
         eliminating synch block between completley independent IndexReaders)
     b) allow more customization of cache management (ie: use
         expiration/replacement strategies, disk backed caches, etc)
     c) allow people to define custom cache data logic (ie: custom
         parsers, complex datatypes, etc... anything tied to a reader)
     d) allow people to inspect what's in a cache (list of CacheKeys) for
         an IndexReader so a new IndexReader can be likewise warmed.
     e) Lend support for smarter cache management if/when
         IndexReader.reopen is added (merging of cached data from subReaders).
2) Provide backwards compatibility to support existing FieldCache API with
     the new implementation, so there is no redundent caching as client code
     migrades to new API.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to