OpenQuizz
Une application de gestion des contenus pédagogiques
FileSystemBytecodeCache Class Reference
Inheritance diagram for FileSystemBytecodeCache:
Collaboration diagram for FileSystemBytecodeCache:

Public Member Functions

def __init__ (self, directory=None, pattern="__jinja2_%s.cache")
 
def load_bytecode (self, bucket)
 
def dump_bytecode (self, bucket)
 
def clear (self)
 
- Public Member Functions inherited from BytecodeCache
def get_cache_key (self, name, filename=None)
 
def get_source_checksum (self, source)
 
def get_bucket (self, environment, name, filename, source)
 
def set_bucket (self, bucket)
 

Data Fields

 directory
 
 pattern
 

Detailed Description

A bytecode cache that stores bytecode on the filesystem.  It accepts
two arguments: The directory where the cache items are stored and a
pattern string that is used to build the filename.

If no directory is specified a default cache directory is selected.  On
Windows the user's temp directory is used, on UNIX systems a directory
is created for the user in the system temp directory.

The pattern can be used to have multiple separate caches operate on the
same directory.  The default pattern is ``'__jinja2_%s.cache'``.  ``%s``
is replaced with the cache key.

>>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')

This bytecode cache supports clearing of the cache using the clear method.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  directory = None,
  pattern = "__jinja2_%s.cache" 
)

Member Function Documentation

◆ clear()

def clear (   self)
Clears the cache.  This method is not used by Jinja but should be
implemented to allow applications to clear the bytecode cache used
by a particular environment.

Reimplemented from BytecodeCache.

◆ dump_bytecode()

def dump_bytecode (   self,
  bucket 
)
Subclasses have to override this method to write the bytecode
from a bucket back to the cache.  If it unable to do so it must not
fail silently but raise an exception.

Reimplemented from BytecodeCache.

◆ load_bytecode()

def load_bytecode (   self,
  bucket 
)
Subclasses have to override this method to load bytecode into a
bucket.  If they are not able to find code in the cache for the
bucket, it must not do anything.

Reimplemented from BytecodeCache.

Field Documentation

◆ directory

directory

◆ pattern

pattern

The documentation for this class was generated from the following file: