Skip to content

FIX: Add Option to Disable Cache or Set TTL #30

@aditya306b

Description

@aditya306b

Currently, pyconify automatically creates a cache that loads into RAM, which can lead to excessive memory usage and cause system hangs or performance degradation in long-running applications. There is no built-in way to disable caching or set a time-to-live (TTL) for cached data.

Problem Statement:

  • The cache keeps accumulating in RAM, leading to high memory consumption.
  • Constantly clearing the cache on every request is not an ideal solution.
  • There should be an option to either disable the cache entirely or set an expiration time (TTL) to manage memory usage more efficiently.

Proposed Solution:

  • Introduce an optional parameter to disable caching
    Example: @pyconify(use_cache=False)
  • Provide a TTL (time-to-live) option for cache expiration
    Example: @pyconify(cache_ttl=300) # Cache expires after 300 seconds

Expected Behavior:

  • If use_cache=False, pyconify should bypass cache creation.
  • If cache_ttl is set, cached data should automatically expire after the given time, preventing unbounded memory usage.
  • The default behavior should remain unchanged for backward compatibility.

Would appreciate your thoughts on this! Thanks for maintaining pyconify. 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions