Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Callable Cloud functions are using ephermal configuration and there's no way to use a URLCache of its requests #13172

Open
jesus-mg-ios opened this issue Jun 23, 2024 · 1 comment

Comments

@jesus-mg-ios
Copy link

Description

Ephemeral Configuration: Callable cloud functions are designed to execute stateless logic triggered by client requests. However, the current setup lacks the capability to selectively cache certain requests while excluding others. This limitation arises because each function invocation starts fresh, without retaining previous state or configuration.

Need for Selective Caching: Selective caching is crucial in scenarios where callable cloud functions interact with external APIs or resources. It allows developers to optimize performance by caching responses that are static or less frequently updated, while ensuring that dynamic or sensitive data is not cached and potentially exposed.

Current Limitations: Due to the ephemeral nature of the configuration:

There's no mechanism to control which requests are cached and which are not within the function's execution context.
All requests are treated uniformly, leading to potential inefficiencies in caching strategies.
Developers are unable to implement fine-grained caching policies tailored to specific application requirements.

API Proposal

To address this issue, we propose enhancing callable cloud functions with:

Selective Caching Control: Introduce a mechanism to specify caching policies based on request parameters or headers.
Integration with Cache-Control Headers: Support Cache-Control headers to allow developers to indicate caching preferences (e.g., max-age, no-cache) for each request.
Programmatic Cache Management: Provide APIs or configuration options to enable developers to programmatically manage caching behavior based on application-specific logic, for example with a thread safe closure with a result of save it on cache or not.

Implementing these enhancements would:

Improve Performance: Enable efficient use of caching by selectively caching appropriate requests, thereby reducing response times and network latency.
Enhance Flexibility: Empower developers to implement caching strategies that align with their application's requirements and data sensitivity.
Maintain Security and Compliance: Ensure sensitive or dynamic data is not inadvertently cached, maintaining data privacy and compliance with regulations.

Firebase Product(s)

Functions

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants