class_docstr: To implement your own bytecode cache you have to subclass this class
  and override :meth:`load_bytecode` and :meth:`dump_bytecode`.  Both of
  these methods are passed a :class:`~jinja2.bccache.Bucket`.
  
  A very basic bytecode cache that saves the bytecode on the file system::
  
      from os import path
  
      class MyCache(BytecodeCache):
  
          def __init__(self, directory):
              self.directory = directory
  
          def load_bytecode(self, bucket):
              filename = path.join(self.directory, bucket.key)
              if path.exists(filename):
                  with open(filename, 'rb') as f:
                      bucket.load_bytecode(f)
  
          def dump_bytecode(self, bucket):
              filename = path.join(self.directory, bucket.key)
              with open(filename, 'wb') as f:
                  bucket.write_bytecode(f)
  
  A more advanced version of a filesystem based bytecode cache is part of
  Jinja.
class_docstr_tok: ["To","implement","your","own","bytecode","cache","you","have","to","subclass","this","class","and","override",":","meth",":","`","load_bytecode","`","and",":","meth",":","`","dump_bytecode","`",".","Both","of","these","methods","are","passed","a",":","class",":","`","~jinja2.bccache.Bucket","`",".","A","very","basic","bytecode","cache","that","saves","the","bytecode","on","the","file","system",":",":","from","os","import","path","class","MyCache","(","BytecodeCache",")",":","def","__init__","(","self",",","directory",")",":","self.directory","=","directory","def","load_bytecode","(","self",",","bucket",")",":","filename","=","path.join","(","self.directory",",","bucket.key",")","if","path.exists","(","filename",")",":","with","open","(","filename",",","'rb","'",")","as","f",":","bucket.load_bytecode","(","f",")","def","dump_bytecode","(","self",",","bucket",")",":","filename","=","path.join","(","self.directory",",","bucket.key",")","with","open","(","filename",",","'wb","'",")","as","f",":","bucket.write_bytecode","(","f",")","A","more","advanced","version","of","a","filesystem","based","bytecode","cache","is","part","of","Jinja","."]
docstr: Returns the unique hash key for this template name.
docstr_tok: ["Returns","the","unique","hash","key","for","this","template","name","."]
code: def get_cache_key(self, name, filename=None):
      """Returns the unique hash key for this template name."""
      hash = sha1(name.encode("utf-8"))
      if filename is not None:
          filename = "|" + filename
          if isinstance(filename, text_type):
              filename = filename.encode("utf-8")
          hash.update(filename)
      return hash.hexdigest()
  
imports: import errno
  import fnmatch
  import os
  import stat
  import sys
  import tempfile
  from hashlib import sha1
  from os import listdir
  from os import path
  from ._compat import BytesIO
  from ._compat import marshal_dump
  from ._compat import marshal_load
  from ._compat import pickle
  from ._compat import text_type
  from .utils import open_if_exists
label_desc: Use image node_id 4 for calling the BytecodeCache obj's underlying member method code with example usage: obj.get_cache_key(name, filename) and returns: hash