Tags:
create new tag
view all tags
ALERT! NOTE: This is a DistributionDocument. This document is generated, please do not change it. Put questions, error notes, and suggestions concerning the documentation of this topic in the comments section below. Use the Support web for problems you are having using TWiki.

Package TWiki::Prefs::PrefsCache

The PrefsCache package holds a cache of topics that have been read in, using the TopicPrefs class. These functions manage that cache.

We maintain 2 hashes of values:

  • {locals} Contains all locals at this level. Locals are values that only apply when the current topic is the topic where the local is defined. The variable names are decorated with the locality where they apply.
  • {values} contains all sets, locals, and all values inherited from the parent level

As each cache level is built, the values are copied down from the parent cache level. This sounds monstrously inefficient, but in fact perl does this a lot better than doing a multi-level lookup when a value is referenced. This is especially important when many prefs lookups may be done in a session, for example when searching.

ClassMethod new ($prefs,$parent,$type,$web,$topic,$prefix)

Creates a new Prefs object.

  • $prefs - controlling TWiki::Prefs object
  • $parent - the PrefsCache object to use to initialise values from
  • $type - Type of prefs object to create, see notes.
  • $web - web containing topic to load from (required is $topic is set)
  • $topic - topic to load from
  • $prefix - key prefix for all preferences (used for plugins)
If the specified topic is not found, returns an empty object.

ObjectMethod finalise ($parent)

Finalise preferences in this cache, by freezing any preferences listed in FINALPREFERENCES at their current value.
  • $parent = object that supports getPreferenceValue

ObjectMethod loadPrefsFromTopic ($web,$topic,$keyPrefix)

Loads preferences from a topic. All settings loaded are prefixed with the key prefix (default '').

ObjectMethod loadPrefsFromText ($text,$web,$topic)

Loads preferences from a topic. All settings loaded are prefixed with the key prefix (default '').

ObjectMethod insert ($type,$key,$val)

Adds a key-value pair of the given type to the object. Type is Set or Local. Callback used for the Prefs::Parser object, or can be used to add arbitrary new entries to a prefs cache.

Note that attempts to redefine final preferences will be ignored.

ObjectMethod stringify ($html,\%shown) -> $text

Generate an (HTML if $html) representation of the content of this cache.



Comments & Questions about this Distribution Document Topic

Please use the Support forum if you have questions about TWiki features. This comment section is about the documentation of this topic.
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-05-01 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.