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

Add support for configuring PreparedStatementCache #229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vijayakumarsuraj
Copy link

@vijayakumarsuraj vijayakumarsuraj commented Nov 11, 2021

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don't submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Issue description

#227 - Allow configuring the prepared statement cache

New Public APIs

  • PreparedStatementCache is now public.
  • Added discovery option preparedStatementCache.

Additional context

The preparedStatementCache discovery option behaves similar to the one in r2dbc-postgresql.

  • -1 = indefinite cache
  • 0 = no cache
  • n = LRU cache with max size n.
  • Additionally, it also accepts the class name of a PreparedStatementCache implementation.

- Make PreparedStatementCache public
- Expose preparedStatementCache discovery option. Similar to what r2dbc-postgresql exposes: -1 = indefinite cache, 0 = no cache, n = lru cache with max size n.
- Add LRUPreparedStatementCache and NoPreparedStatementCache implementations. 

[r2dbc#227]

Signed-off-by: Suraj Vijayakumar <[email protected]>
@mp911de
Copy link
Member

mp911de commented Nov 12, 2021

Thanks a lot. For a proper implementation of the cache we need to call sp_unprepare <handle> somewhere, ideally when the cache entry is being removed. Calling unprepare can interfere with the ongoing query so that might require some special attention.

@xnart
Copy link

xnart commented May 8, 2022

For now, can we provide only NoPreparedStatementCache to allow disabling cache ? If it is ok i can create new PR.

@mp911de mp911de force-pushed the main branch 2 times, most recently from e100d53 to 15a65ac Compare November 9, 2022 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring the prepared statement cache
3 participants