Skip to content

datacacheconfig

Pydantic DataCache Configuration Data Model.

DataCacheConfig

Bases: AttrDict

DataCache Configuration.

This class should not be used directly as a configuration object for a strategy object, but only as a configuration field inside a configuration object.

Source code in oteapi/models/datacacheconfig.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class DataCacheConfig(AttrDict):
    """DataCache Configuration.

    This class should not be used directly as a configuration object
    for a strategy object, but only as a configuration field inside
    a configuration object.
    """

    cacheDir: Path = Field(Path("oteapi"), description="Cache directory.")
    accessKey: Optional[str] = Field(
        None,
        description="Key with which the downloaded content can be accessed. "
        "Should preferable be the hash (corresponding to `hashType`) of the "
        "content if it is known.",
    )
    hashType: str = Field(
        "md5",
        description="Hash algorithm to use for creating hash keys for stored "
        "data. Can be any algorithm supported by hashlib.",
    )
    expireTime: int = Field(
        3600 * 24 * 14,
        description="Number of seconds before the cache entry expires. "
        "Zero means no expiration. Default is two weeks.",
    )
    tag: Optional[str] = Field(
        None,
        description="Tag assigned to the downloaded content, typically "
        "identifying a session. Used with the `evict()` method to clean up a "
        "all cache entries with a given tag.",
    )

accessKey: Optional[str] = Field(None, description='Key with which the downloaded content can be accessed. Should preferable be the hash (corresponding to `hashType`) of the content if it is known.') class-attribute instance-attribute

cacheDir: Path = Field(Path('oteapi'), description='Cache directory.') class-attribute instance-attribute

expireTime: int = Field(3600 * 24 * 14, description='Number of seconds before the cache entry expires. Zero means no expiration. Default is two weeks.') class-attribute instance-attribute

hashType: str = Field('md5', description='Hash algorithm to use for creating hash keys for stored data. Can be any algorithm supported by hashlib.') class-attribute instance-attribute

tag: Optional[str] = Field(None, description='Tag assigned to the downloaded content, typically identifying a session. Used with the `evict()` method to clean up a all cache entries with a given tag.') class-attribute instance-attribute