Skip to content

[Feature Idea] Result Caching #42

@albertalef

Description

@albertalef

Problem: Scripts that call the same expensive command multiple times waste time re-executing identical operations, especially with API calls or slow queries.

Solution: Add _cache option to cache command results for a specified duration in seconds, returning cached results for subsequent identical calls.

sh.curl(api_url, _cache: 60)  # cache for 60 seconds

data1 = sh.curl(api_url, _cache: 60)
data2 = sh.curl(api_url, _cache: 60)  # instant, from cache

# Force refresh
sh.curl(api_url, _cache: 60, _refresh_cache: true)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions