@@ -46,6 +46,7 @@ namespace
|
||||
|
||||
ContentStorageService ContentStorageServiceInstance;
|
||||
|
||||
TimeSpan ContentStorageManager::UnusedStorageLifetime = TimeSpan::FromSeconds(0.5f);
|
||||
TimeSpan ContentStorageManager::UnusedDataChunksLifetime = TimeSpan::FromSeconds(10);
|
||||
|
||||
FlaxStorageReference ContentStorageManager::GetStorage(const StringView& path, bool loadIt)
|
||||
|
||||
@@ -15,7 +15,12 @@ class FLAXENGINE_API ContentStorageManager
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Auto-release timeout for unused asset chunks.
|
||||
/// Auto-release timeout for unused asset files.
|
||||
/// </summary>
|
||||
static TimeSpan UnusedStorageLifetime;
|
||||
|
||||
/// <summary>
|
||||
/// Auto-release timeout for unused asset data chunks.
|
||||
/// </summary>
|
||||
static TimeSpan UnusedDataChunksLifetime;
|
||||
|
||||
|
||||
@@ -286,14 +286,14 @@ FlaxStorage::LockData FlaxStorage::LockSafe()
|
||||
|
||||
uint32 FlaxStorage::GetRefCount() const
|
||||
{
|
||||
return (uint32)Platform::AtomicRead((int64*)&_refCount);
|
||||
return (uint32)Platform::AtomicRead(&_refCount);
|
||||
}
|
||||
|
||||
bool FlaxStorage::ShouldDispose() const
|
||||
{
|
||||
return Platform::AtomicRead((int64*)&_refCount) == 0 &&
|
||||
Platform::AtomicRead((int64*)&_chunksLock) == 0 &&
|
||||
Platform::GetTimeSeconds() - _lastRefLostTime >= 0.5; // TTL in seconds
|
||||
return Platform::AtomicRead(&_refCount) == 0 &&
|
||||
Platform::AtomicRead(&_chunksLock) == 0 &&
|
||||
Platform::GetTimeSeconds() - _lastRefLostTime >= ContentStorageManager::UnusedStorageLifetime.GetTotalSeconds();
|
||||
}
|
||||
|
||||
uint32 FlaxStorage::GetMemoryUsage() const
|
||||
|
||||
Reference in New Issue
Block a user