public class

DatabaseQueueFlushedEntryCache

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.search.lucene.queue.DatabaseQueueFlushedEntryCache

Class Overview

Provides a cache of IndexQueueEntry objects that were added to the queue close to an index flush. Because the entry timestamps are stored in the database with only accuracy to the nearest second, these entries may be returned when the next flush runs, and we want to prevent rerunning them. The cacheWindowMillis controls the retention of the cache, and should be set to twice the database accuracy (typically 2000). Entries are added/kept if created within cacheWindowMillis milliseconds of a flush. Entries are removed if created outside cacheWindowMillis milliseconds of a flush.

Summary

Fields
public static final Logger log
Public Constructors
DatabaseQueueFlushedEntryCache(long cacheWindowMillis)
Public Methods
synchronized void add(IndexQueueEntry entry)
Should only be used for testing.
synchronized void addEntries(List entriesOldestFirst, Date relativeTo)
Adds entries to the cache created on or after (relativeTo - cacheWindowMillis)
synchronized boolean contains(IndexQueueEntry entry)
synchronized void removeOldEntries(Date relativeTo)
Removes items from the cache created before (relativeTo - cacheWindowMillis)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final Logger log

Public Constructors

public DatabaseQueueFlushedEntryCache (long cacheWindowMillis)

Parameters
cacheWindowMillis Controls timing for entry retention. Entries are added/kept if created within cacheWindowMillis milliseconds of a flush. Entries are removed if created outside cacheWindowMillis milliseconds of a flush.

Public Methods

public synchronized void add (IndexQueueEntry entry)

Should only be used for testing. Use addEntries() in production code.

public synchronized void addEntries (List entriesOldestFirst, Date relativeTo)

Adds entries to the cache created on or after (relativeTo - cacheWindowMillis)

Parameters
entriesOldestFirst a list of entries sorted by creationDate ascending
relativeTo typically when the current flush started

public synchronized boolean contains (IndexQueueEntry entry)

public synchronized void removeOldEntries (Date relativeTo)

Removes items from the cache created before (relativeTo - cacheWindowMillis)

Parameters
relativeTo typically when the current flush started