class_docstr: Serialize a Dataflow to a diskcache database, where the keys are indices and values
  are serialized datapoints.
  
  Example:
  
  .. code-block:: python
  
      DiskCacheSerializer.save(my_df, "output.diskcache")
  
      new_df = DiskCacheSerializer.load("output.diskcache", shuffle=True)
class_docstr_tok: ["Serialize","a","Dataflow","to","a","diskcache","database",",","where","the","keys","are","indices","and","values","are","serialized","datapoints",".","Example",":","..","code-block",":",":","python","DiskCacheSerializer.save","(","my_df",",","``","output.diskcache","''",")","new_df","=","DiskCacheSerializer.load","(","``","output.diskcache","''",",","shuffle=True",")"]
docstr: Args:
      df (DataFlow): the DataFlow to serialize.
      path (str): output path. Either a directory or an lmdb file.
docstr_tok: ["Args",":","df","(","DataFlow",")",":","the","DataFlow","to","serialize",".","path","(","str",")",":","output","path",".","Either","a","directory","or","an","lmdb","file","."]
code: def save(df, path, write_frequency=5000):
      """
      Args:
          df (DataFlow): the DataFlow to serialize.
          path (str): output path. Either a directory or an lmdb file.
      """
      assert isinstance(df, DataFlow), type(df)
      assert not os.path.isfile(
          path
      ), "DiskCache path {} must be a directory!".format(path)
      db = diskcache.Index(path)
      size = _reset_df_and_get_size(df)
  
      with get_tqdm(total=size) as pbar:
          idx = -1
  
          for idx, dp in enumerate(df):
              db[idx] = dumps(dp)
              pbar.update()
  
imports: import numpy
  import os
  import platform
  from collections import defaultdict
  from ..utils import logger
  from ..utils.serialize import dumps, loads
  from ..utils.develop import create_dummy_class
  from ..utils.utils import get_tqdm
  from .base import DataFlow
  from .common import FixedSizeData, MapData
  from .format import HDF5Data, LMDBData, DiskCacheData
  from .raw import DataFromGenerator, DataFromList
label_desc: Use image node_id 1 for calling the DiskCacheSerializer obj's underlying member method code with example usage: obj.save(df, path, write_frequency) without return types