8000 8000
Skip to content

Add support for configuring PreparedStatementCache - #229

Open
vijayakumarsuraj wants to merge 1 commit into
r2dbc:mainfrom
vijayakumarsuraj:gh-227
Open

Add support for configuring PreparedStatementCache#229
vijayakumarsuraj wants to merge 1 commit into
r2dbc:mainfrom
vijayakumarsuraj:gh-227

Conversation

@vijayakumarsuraj
@vijayakumarsuraj vijayakumarsuraj commented Nov 11, 2021
Copy link
Copy Markdown

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 <vijayakumar.suraj@gmail.com>
@mp911de
mp911de commented Nov 12, 2021
Copy link
Copy Markdown
Member

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
xnart commented May 8, 2022
Copy link
Copy Markdown

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

0