Lucene.Net.Search.FieldCacheImpl.Cache.Get C# (CSharp) Method

Get() public method

public Get ( Lucene.Net.Index.IndexReader reader, Entry key ) : Object
reader Lucene.Net.Index.IndexReader
key Entry
return System.Object
            public virtual System.Object Get(IndexReader reader, Entry key)
            {
                IDictionary<Entry, object> innerCache;
                System.Object value;
                System.Object readerKey = reader.FieldCacheKey;
                lock (readerCache)
                {
                    innerCache = readerCache[readerKey];
                    if (innerCache == null)
                    {
                        innerCache = new HashMap<Entry, object>();
                        readerCache[readerKey] = innerCache;
                        value = null;
                    }
                    else
                    {
                        value = innerCache[key];
                    }
                    if (value == null)
                    {
                        value = new CreationPlaceholder();
                        innerCache[key] = value;
                    }
                }
                if (value is CreationPlaceholder)
                {
                    lock (value)
                    {
                        CreationPlaceholder progress = (CreationPlaceholder) value;
                        if (progress.value_Renamed == null)
                        {
                            progress.value_Renamed = CreateValue(reader, key);
                            lock (readerCache)
                            {
                                innerCache[key] = progress.value_Renamed;
                            }
                            
                            // Only check if key.custom (the parser) is
                            // non-null; else, we check twice for a single
                            // call to FieldCache.getXXX
                            if (key.custom != null && wrapper != null)
                            {
                                System.IO.StreamWriter infoStream = wrapper.InfoStream;
                                if (infoStream != null)
                                {
                                    PrintNewInsanity(infoStream, progress.value_Renamed);
                                }
                            }
                        }
                        return progress.value_Renamed;
                    }
                }
                return value;
            }