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

feat: Add cache usage option for identify calls #408

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

keelerm84
Copy link
Member

The cache handling option allows users to control the flag store transitions while identification network requests asynchronously resolve.

@keelerm84 keelerm84 requested a review from a team as a code owner October 17, 2024 17:01
*/
public enum IdentifyCacheHandling {
/**
`keep` will maintain the current in memory store of any previously known flag values from the last identified context.
Copy link
Contributor

@tanderson-ld tanderson-ld Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to move the language away from talking about the memory store? Then this contract is more general and survives future changes we may make to the caching/memory store layers. It is also then in language that the customer would speak in before understanding the deeper structure of the SDK memory stores.
You used ‘maintain’ in the descriptions. I like maintain more than keep and I think choosing one verb is more clear.

I propose moving away from “onMiss” to avoid mixing positive and negative language.

I propose moving away from Discard to avoid implying losing data. If the consumer uses identify to go back to the previous context again, the flag variations may still be in the cache.

“MaintainUntilFresh” maintains the current flag variations until the SDK is able to fetch fresh flag variations for the provided context.
“MaintainOrUseCached” maintains the current flag variations until the SDK is able to use cached flag variations for the provided context or fetch fresh flag variations.
“DontMaintain” does not maintain the current flag variations. Immediately switches to cached flag variations for the provided context or defaults if no cached flag variations exist.

Copy link
Contributor

@tanderson-ld tanderson-ld Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still unsure of this API being in terms of previous/current state and not in terms of desired state when init/start and the data store system Casey is working on are in terms of desired state.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's enough divergence of client/server-side SDKs (servers lacking identify) that I think we can't quite fit this into that spec. So my opinion is that we evaluate this change mostly independent of the data system stuff.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought more about this. It may be a significant pro to keep this scoped to caching while we learn how people will use it. Offering a general contract too soon could be worse.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean you don't want your initially proposed changes to the language?

I think there's enough divergence of client/server-side SDKs (servers lacking identify) that I think we can't quite fit this into that spec

☝🏼 I also think FDv2 for iOS is probably just going to also coincide with a v10 release where we can completely change these signatures. Hopeful it will be the whole re-write, but it will at least have to be a major version.

Copy link
Contributor

@tanderson-ld tanderson-ld Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From discussion this morning:

keep -> UseCache: No
keepOnMiss -> UseCache: OnlyIfAvailable
discard -> UseCache: Yes

LaunchDarkly/LaunchDarkly/Models/IdentifyTypes.swift Outdated Show resolved Hide resolved
@keelerm84 keelerm84 changed the title feat: Add cache handling option for identify calls feat: Add cache usage option for identify calls Oct 18, 2024
The cache handling option allows users to control the flag store
transitions while identification network requests asynchronously
resolve.
@keelerm84 keelerm84 force-pushed the mk/sdk-767/discard-keep-identify branch from 688745f to c8189d5 Compare October 18, 2024 21:03
@keelerm84 keelerm84 merged commit b928345 into v9 Nov 6, 2024
4 checks passed
@keelerm84 keelerm84 deleted the mk/sdk-767/discard-keep-identify branch November 6, 2024 21:19
keelerm84 pushed a commit that referenced this pull request Nov 6, 2024
🤖 I have created a release *beep* *boop*
---


##
[9.12.0](9.11.0...9.12.0)
(2024-11-06)


### Features

* Add `LDConfig.sendEvents` option to disable all events
([#414](#414))
([9a51844](9a51844))
* Add cache usage option for identify calls
([#408](#408))
([b928345](b928345))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
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.

3 participants