xml.cache
Class Cache

java.lang.Object
  extended by org.gjt.sp.jedit.buffer.BufferAdapter
      extended by xml.cache.Cache
All Implemented Interfaces:
org.gjt.sp.jedit.buffer.BufferListener

public final class Cache
extends org.gjt.sp.jedit.buffer.BufferAdapter

caching policy : - a file-based CacheEntry is valid until opened in jEdit - a buffer-based CacheEntry is invalidated on change of the buffer - a CacheEntry is discarded once all buffers requiring it are closed (similar to reference-counting) cache cleaners : - listen to Buffer modifications and invalidates entries related to them - listen to Buffer open and invalidates file based CacheEntry - listen to Buffer close and invalidate buffer based CacheEntry and invalidate cache entries no more required


Method Summary
 void clear()
          remove all cache entries
 void contentInserted(org.gjt.sp.jedit.buffer.JEditBuffer buffer, int startLine, int offset, int numLines, int length)
          invalidate cache entries corresponding to (not requested by) this buffer
 void contentRemoved(org.gjt.sp.jedit.buffer.JEditBuffer buffer, int startLine, int offset, int numLines, int length)
          invalidate cache entries corresponding to (not requested by) this buffer
 void disable()
          disable caching (persistent)
 void enable()
          enable caching (persistent)
 CacheEntry get(java.lang.String path, java.lang.Object key)
           
 void handleBufferContentChanged(org.gjt.sp.jedit.Buffer buffer)
           
 void handleBufferUpdate(org.gjt.sp.jedit.msg.BufferUpdate message)
           
static Cache instance()
           
 CacheEntry put(java.lang.String path, java.lang.Object key, java.lang.Object value)
           
 void start()
          add to EditBus
 void stop()
          clear, remove from EditBus, forget singleton
 void transactionComplete(org.gjt.sp.jedit.buffer.JEditBuffer buffer)
          invalidate cache entries corresponding to (not requested by) this buffer
 
Methods inherited from class org.gjt.sp.jedit.buffer.BufferAdapter
bufferLoaded, foldHandlerChanged, foldLevelChanged, preContentInserted, preContentRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static Cache instance()

put

public CacheEntry put(java.lang.String path,
                      java.lang.Object key,
                      java.lang.Object value)
Parameters:
path - path of cached resource (file:/ urls are equivalent to paths)
key - unambiguously distinguish schema from completionInfo from...

get

public CacheEntry get(java.lang.String path,
                      java.lang.Object key)
Parameters:
path - path of cached resource (file:/ urls are equivalent to paths)
key - unambiguously distinguish schema from completionInfo from...

contentInserted

public void contentInserted(org.gjt.sp.jedit.buffer.JEditBuffer buffer,
                            int startLine,
                            int offset,
                            int numLines,
                            int length)
invalidate cache entries corresponding to (not requested by) this buffer

Specified by:
contentInserted in interface org.gjt.sp.jedit.buffer.BufferListener
Overrides:
contentInserted in class org.gjt.sp.jedit.buffer.BufferAdapter

contentRemoved

public void contentRemoved(org.gjt.sp.jedit.buffer.JEditBuffer buffer,
                           int startLine,
                           int offset,
                           int numLines,
                           int length)
invalidate cache entries corresponding to (not requested by) this buffer

Specified by:
contentRemoved in interface org.gjt.sp.jedit.buffer.BufferListener
Overrides:
contentRemoved in class org.gjt.sp.jedit.buffer.BufferAdapter

transactionComplete

public void transactionComplete(org.gjt.sp.jedit.buffer.JEditBuffer buffer)
invalidate cache entries corresponding to (not requested by) this buffer

Specified by:
transactionComplete in interface org.gjt.sp.jedit.buffer.BufferListener
Overrides:
transactionComplete in class org.gjt.sp.jedit.buffer.BufferAdapter

handleBufferUpdate

public void handleBufferUpdate(org.gjt.sp.jedit.msg.BufferUpdate message)

handleBufferContentChanged

public void handleBufferContentChanged(org.gjt.sp.jedit.Buffer buffer)

start

public void start()
add to EditBus


stop

public void stop()
clear, remove from EditBus, forget singleton


clear

public void clear()
remove all cache entries


disable

public void disable()
disable caching (persistent)


enable

public void enable()
enable caching (persistent)