WeddingPlatform.Web 1.0.0.0
지도, 갤러리, 방명록, 계좌 안내와 배경음악을 링크 하나에 담는 무료 모바일 청첩장 서비스입니다.
로딩중...
검색중...
일치하는것 없음
WeddingPlatform.Services.JsonGlobalSettingsStore 클래스 참조sealed
WeddingPlatform.Services.JsonGlobalSettingsStore에 대한 상속 다이어그램 :
WeddingPlatform.Services.JsonGlobalSettingsStore에 대한 협력 다이어그램:

Public 멤버 함수

 JsonGlobalSettingsStore (WeddingOptions opts)
async Task< GlobalSettingsGetAsync (CancellationToken ct=default)
async Task SaveAsync (GlobalSettings settings, CancellationToken ct=default)

Private 속성

readonly string _path
GlobalSettings_cache

정적 Private 속성

static readonly SemaphoreSlim _gate = new(1, 1)
static readonly JsonSerializerOptions _jsonOpts = new() { WriteIndented = true }

상세한 설명

JsonGlobalSettingsStore.cs 파일의 18 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ JsonGlobalSettingsStore()

WeddingPlatform.Services.JsonGlobalSettingsStore.JsonGlobalSettingsStore ( WeddingOptions opts)
inline

지정한 설정으로 JsonGlobalSettingsStore 클래스의 새 인스턴스를 초기화합니다.

매개변수
optsopts에 사용할 WeddingOptions 값입니다.

JsonGlobalSettingsStore.cs 파일의 74 번째 라인에서 정의되었습니다.

75 {
76 var dataRoot = Path.GetDirectoryName(opts.ResolvedDataPath.TrimEnd(Path.DirectorySeparatorChar))
77 ?? Path.Combine(AppContext.BaseDirectory, "App_Data");
78 Directory.CreateDirectory(dataRoot);
79 _path = Path.Combine(dataRoot, "global-settings.json");
80 }

다음을 참조함 : _path, WeddingPlatform.Services.WeddingOptions.ResolvedDataPath.

멤버 함수 문서화

◆ GetAsync()

async Task< GlobalSettings > WeddingPlatform.Services.JsonGlobalSettingsStore.GetAsync ( CancellationToken ct = default)
inline

Async 값을 가져옵니다.

매개변수
ct취소 요청을 감시하는 토큰입니다.
반환값
Get Async 작업에서 생성한 Task<GlobalSettings> 결과입니다.

WeddingPlatform.Services.IGlobalSettingsStore를 구현.

JsonGlobalSettingsStore.cs 파일의 106 번째 라인에서 정의되었습니다.

107 {
108 if (_cache is not null) return _cache;
109
110 await _gate.WaitAsync(ct).ConfigureAwait(false);
111 try
112 {
113 if (_cache is not null) return _cache;
114
115 if (!File.Exists(_path))
116 {
117 _cache = new GlobalSettings();
118 return _cache;
119 }
120
121 await using var fs = File.OpenRead(_path);
122 _cache = await JsonSerializer.DeserializeAsync<GlobalSettings>(fs, _jsonOpts, ct).ConfigureAwait(false)
123 ?? new GlobalSettings();
124 _cache.Normalize();
125 return _cache;
126 }
127 finally { _gate.Release(); }
128 }

다음을 참조함 : _cache, _gate, _jsonOpts, _path.

◆ SaveAsync()

async Task WeddingPlatform.Services.JsonGlobalSettingsStore.SaveAsync ( GlobalSettings settings,
CancellationToken ct = default )
inline

Async 데이터를 저장합니다.

매개변수
settingssettings에 사용할 GlobalSettings 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Save Async 작업에서 생성한 Task 결과입니다.

WeddingPlatform.Services.IGlobalSettingsStore를 구현.

JsonGlobalSettingsStore.cs 파일의 162 번째 라인에서 정의되었습니다.

163 {
164 settings.Normalize();
165 await _gate.WaitAsync(ct).ConfigureAwait(false);
166 try
167 {
168 var tmp = _path + ".tmp";
169 await using (var fs = File.Create(tmp))
170 await JsonSerializer.SerializeAsync(fs, settings, _jsonOpts, ct).ConfigureAwait(false);
171
172 File.Copy(tmp, _path, overwrite: true);
173 File.Delete(tmp);
174 _cache = settings;
175 }
176 finally { _gate.Release(); }
177 }

다음을 참조함 : _cache, _gate, _jsonOpts, _path, WeddingPlatform.Models.GlobalSettings.Normalize().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _cache

GlobalSettings? WeddingPlatform.Services.JsonGlobalSettingsStore._cache
private

cache 값을 보관합니다.

JsonGlobalSettingsStore.cs 파일의 46 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : GetAsync(), SaveAsync().

◆ _gate

readonly SemaphoreSlim WeddingPlatform.Services.JsonGlobalSettingsStore._gate = new(1, 1)
staticprivate

gate 값을 보관합니다.

JsonGlobalSettingsStore.cs 파일의 37 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : GetAsync(), SaveAsync().

◆ _jsonOpts

readonly JsonSerializerOptions WeddingPlatform.Services.JsonGlobalSettingsStore._jsonOpts = new() { WriteIndented = true }
staticprivate

json Opts 값을 보관합니다.

JsonGlobalSettingsStore.cs 파일의 56 번째 라인에서 정의되었습니다.

56{ WriteIndented = true };

다음에 의해서 참조됨 : GetAsync(), SaveAsync().

◆ _path

readonly string WeddingPlatform.Services.JsonGlobalSettingsStore._path
private

path 값을 보관합니다.

JsonGlobalSettingsStore.cs 파일의 28 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : GetAsync(), JsonGlobalSettingsStore(), SaveAsync().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: