-
Notifications
You must be signed in to change notification settings - Fork 8
Implement Add
and Replace
support
#28
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
Implement Add
and Replace
support
#28
Conversation
|
||
// MARK: - Adding a Value | ||
|
||
/// Adds a value to a new key in the Memcached server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Adds a value to a new key in the Memcached server. | |
/// Adds a new key-value pair in the Memcached server. |
Tests/SwiftMemcacheTests/IntegrationTest/MemcachedIntegrationTests.swift
Show resolved
Hide resolved
Tests/SwiftMemcacheTests/IntegrationTest/MemcachedIntegrationTests.swift
Show resolved
Hide resolved
} | ||
} | ||
|
||
func testReplaceValue() async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test where the key/value pair doesn't exist yet
if "\(error)" != "keyNotFound" { | ||
throw error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we really need to work on better public errors so we allow users to catch this without relying on the string description of the error. Let's create an issue for this.
This PR addresses the need to enhance our Memcache functionality with
add
andreplace
operation support. These operations enable modifying key-value pairs by providing a more granular level of control over how data is stored. This PR closes #25.Motivation:
To improve our interactions with memcached servers in a more dynamic and versatile way.
Add
andReplace
operations not only increase cache efficiency by minimizing network round trips for data modification but also broadens our API capabilities.Modifications:
add
andreplace
methods toMemcachedConnection
.StorageMode
enum to handleadd
andreplace
state.Result:
With the addition of
add
andreplace
support, our API now allows users to add and modify data in the cache directly, improving cache efficiency and expanding the versatility of our API.