|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
DCacheAdapter | A lightweight wrapper type for DefinitionsDocuments that may or may not be resident in memory. |
DDReconstructor | The Reconstructor is a closure that builds a document. |
DocumentCache.RegistrationListener | This interface allows the unit tests to get a handle on what's going on since the work is spread between the ODD, the cache, and the Adapters. |
Class Summary | |
---|---|
DocumentCache | The document cache is a structure that maps OpenDefinitionsDocuments to DefinitionsDocuments (which contain the actual document text). |
DocumentCacheTest | This used to extend GlobalModelTestCase, but now it extends just TestCase. |
The idea behind this new interface is that the rest of the model should not talk directly to the document cache but rather to an adapter to the cache. For example, in the old implementation, when the OpenDefinitionsDocument needed to get the DefinitionsDocument, the code would look like this:
DefinitionsDocument getDocument() {
...
return _cache.get(this);
...
}
public boolean isModifiedSinceSave() {
if(_cache.isDDocInCache(this)){
return getDocument().isModifiedSinceSave();
}
else{
return false;
}
}
But now the code looks like this:
DefinitionsDocument getDocument() {
...
return _cacheAdapter.getDocument();
...
}
public boolean isModifiedSinceSave() {
if(_cacheAdpater.isReady()){
return getDocument().isModifiedSinceSave();
}
else{
return false;
}
}
On the inside of the cache, these DCacheAdapters serve as managers for the instances of the DefinitionsDocuments. They are responsible for storing the unique reference to the document. The cache that created it keeps an LRU of these managers/adapters and tells the manager to discard its document if its place in the LRU has expired.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |