This repository was archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 448
Utilizing a cache for user data #427
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
2d0b24b
Merge branch 'fixes/git-client-set-user' into enhancements/git-client…
StanleyGoldman f08fd3c
Merge branch 'fixes/git-client-set-user' into enhancements/git-client…
StanleyGoldman 7e0f82f
Merge branch 'fixes/git-client-set-user' into enhancements/git-client…
StanleyGoldman b5351bd
Exposing CurrentUser in GitClient
StanleyGoldman 98a9af3
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman bf459e2
Utilizing the git user cache better
StanleyGoldman 90f1db4
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman 06d801a
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman e5056f1
Merge branch 'fixes/repository-manager-warning' into enhancements/git…
StanleyGoldman 088ed69
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman d4f5576
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman 46c8dde
Reordering functions
StanleyGoldman 92cea97
More code formatting
StanleyGoldman 3e9aa3d
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman 1de70d6
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman 60312fd
Migrating Caching of user data from GitClient to User
StanleyGoldman 9643fb8
Serialize the name and email directly
StanleyGoldman e61025b
Merge branch 'enhancements/using-cache-invalidated-events' into enhan…
StanleyGoldman e54fef8
GitName and GitEmail might be null themselves
StanleyGoldman 7ac73ec
Moving functionality to set name and email
StanleyGoldman 03e1f7d
Checking if gitClient is null
StanleyGoldman 1b89aee
Renaming event
StanleyGoldman c74b1ea
Renaming method
StanleyGoldman 293f150
Updating needsSaving after we get an update from the cache
StanleyGoldman d99a9a2
Merge branch 'master' into enhancements/git-client-cache
StanleyGoldman 0d2f8a0
Renaming ShouldRaiseCacheEvent to IsLastUpdatedTimeDifferent
StanleyGoldman 675064b
Merge branch 'fixes/settings-view-repository-null' into enhancements/…
StanleyGoldman 8e42a42
Merge branch 'fixes/date-time-format-string' into enhancements/git-cl…
StanleyGoldman 2e16908
Merge branch 'master' into enhancements/git-client-cache
StanleyGoldman 1db3448
Merge branch 'master' into enhancements/git-client-cache
StanleyGoldman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using System; | ||
|
|
||
| namespace GitHub.Unity | ||
| { | ||
| static class ManagedCacheExtensions | ||
| { | ||
| public static bool IsLastUpdatedTimeDifferent(this IManagedCache managedCache, CacheUpdateEvent cacheUpdateEvent) | ||
| { | ||
| bool isDifferent; | ||
| if (cacheUpdateEvent.UpdatedTimeString == null) | ||
| { | ||
| isDifferent = managedCache.LastUpdatedAt != DateTimeOffset.MinValue; | ||
| } | ||
| else | ||
| { | ||
| isDifferent = managedCache.LastUpdatedAt.ToString() != cacheUpdateEvent.UpdatedTimeString; | ||
| } | ||
| return isDifferent; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Will the
Userobjects never need to be GCd? Adding these event handlers will mean thatcacheContainer.GitUserCachewill retain a reference to eachUserobject.Uh oh!
There was an error while loading. Please reload this page.
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.
UserandRepositoryare found onDefaultEnvironment.Unity/src/GitHub.Api/Platform/IEnvironment.cs
Lines 30 to 31 in 2e16908
Unity/src/GitHub.Api/Platform/DefaultEnvironment.cs
Lines 137 to 138 in 2e16908
There is generally only one instance of
UserandRepositoryin the system created at specific points of initialization.Unity/src/GitHub.Api/Platform/DefaultEnvironment.cs
Line 51 in 2e16908
Unity/src/GitHub.Api/Platform/DefaultEnvironment.cs
Line 89 in 2e16908
These objects are only "destroyed" when the domain reloads.
When they are constructed (either the first time or after a domain reload) these objects are being fed a
CacheContainer. It will take a moment on some other threads for theUserandRepositoryobjects to get what they need to be fully functioning (they both haveInitializemethods for that).These objects store their data in file based caches specifically for this reason. Until they are fully functioning, they get to use their file based cache to supply data to the user interface.