Skip to content

Commit ccffa72

Browse files
author
TheNexusAvenger
committed
Resolve code style request.
1 parent 54ffbb5 commit ccffa72

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Uchu.World/Client/CdClient/TableCache.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace Uchu.World.Client
1313
/// </summary>
1414
public class TableCache<T> where T : class
1515
{
16-
private PropertyInfo cdClientContextProperty;
17-
private T[] cachedData;
18-
private long lastAccessTime = 0;
19-
private bool clearDataQueued = false;
20-
private int clearTimeMilliseconds = 3000;
16+
private PropertyInfo CdClientContextProperty;
17+
private T[] CachedData;
18+
private long LastAccessTime = 0;
19+
private bool ClearDataQueued = false;
20+
private int ClearTimeMilliseconds = 3000;
2121

2222
/// <summary>
2323
/// Creates the table cache.
@@ -28,12 +28,12 @@ public TableCache(string tableName)
2828
foreach (var property in typeof(CdClientContext).GetProperties())
2929
{
3030
if (property.Name != tableName) continue;
31-
cdClientContextProperty = property;
31+
CdClientContextProperty = property;
3232
break;
3333
}
3434

3535
// Throw an exception if the table name is invalid.
36-
if (cdClientContextProperty == null)
36+
if (CdClientContextProperty == null)
3737
{
3838
throw new InvalidOperationException("Table name doesn't exist: " + tableName);
3939
}
@@ -45,23 +45,23 @@ public TableCache(string tableName)
4545
public async Task<T[]> GetValuesAsync()
4646
{
4747
// Update the last access time and fetch the data if it isn't stored.
48-
lastAccessTime = DateTimeOffset.Now.ToUnixTimeSeconds();
49-
if (cachedData == default)
48+
LastAccessTime = DateTimeOffset.Now.ToUnixTimeSeconds();
49+
if (CachedData == default)
5050
{
5151
// Fetch the data.
5252
await using var cdContext = new CdClientContext();
53-
cachedData = ((DbSet<T>) cdClientContextProperty.GetValue(cdContext))?.ToArray();
53+
CachedData = ((DbSet<T>) CdClientContextProperty.GetValue(cdContext))?.ToArray();
5454

5555
// Queue clearing the data.
56-
if (!clearDataQueued)
56+
if (!ClearDataQueued)
5757
{
58-
clearDataQueued = true;
58+
ClearDataQueued = true;
5959
Task.Run(ClearQueueTimeAsync);
6060
}
6161
}
6262

6363
// Return the cached data.
64-
return cachedData;
64+
return CachedData;
6565
}
6666

6767
/// <summary>
@@ -73,13 +73,13 @@ private async void ClearQueueTimeAsync()
7373
while (true)
7474
{
7575
// Wait the delay before checking to clear the table.
76-
var startLastAccessTime = lastAccessTime;
77-
await Task.Delay(clearTimeMilliseconds);
76+
var startLastAccessTime = LastAccessTime;
77+
await Task.Delay(ClearTimeMilliseconds);
7878

7979
// Clear the table if it hasn't been accessed recently.
80-
if (startLastAccessTime != lastAccessTime) continue;
81-
cachedData = default;
82-
clearDataQueued = false;
80+
if (startLastAccessTime != LastAccessTime) continue;
81+
CachedData = default;
82+
ClearDataQueued = false;
8383
GC.Collect();
8484
return;
8585
}

0 commit comments

Comments
 (0)