UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RuntimeAssetCacheBucket.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "Containers/Map.h"
9#include "Misc/ScopeLock.h"
10
12
15
20{
21public:
24 : Size(DefaultBucketSize)
25 , CurrentSize(0)
26 { }
27
33 : Size(InSize)
34 , CurrentSize(0)
35 { }
36
39
41 int32 GetSize() const
42 {
43 return Size;
44 }
45
49 void Reset();
50
56 FCacheEntryMetadata* GetMetadata(const FString& Key);
57
63 void RemoveMetadataEntry(const FString& Key, bool bBuildFailed = false);
64
71 void AddMetadataEntry(const FString& Key, FCacheEntryMetadata* Value, bool bUpdateSize);
72
77 {
78 FScopeLock Lock(&CurrentSizeCriticalSection);
79 return CurrentSize;
80 }
81
87 {
88 FScopeLock Lock(&CurrentSizeCriticalSection);
89 CurrentSize += Value;
90 check(CurrentSize <= Size);
91 }
92
98
101
102private:
105
107 FCriticalSection MetadataCriticalSection;
108
110 int32 Size;
111
113 int32 CurrentSize;
114
116 FCriticalSection CurrentSizeCriticalSection;
117
120};
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
Definition RuntimeAssetCacheEntryMetadata.h:16
Definition RuntimeAssetCacheBucketScopeLock.h:12
Definition RuntimeAssetCacheBucket.h:20
FCacheEntryMetadata * GetMetadata(const FString &Key)
Definition RuntimeAssetCacheBucket.cpp:29
int32 GetSize() const
Definition RuntimeAssetCacheBucket.h:41
void RemoveMetadataEntry(const FString &Key, bool bBuildFailed=false)
Definition RuntimeAssetCacheBucket.cpp:35
void AddMetadataEntry(const FString &Key, FCacheEntryMetadata *Value, bool bUpdateSize)
Definition RuntimeAssetCacheBucket.cpp:48
static const int32 DefaultBucketSize
Definition RuntimeAssetCacheBucket.h:100
FRuntimeAssetCacheBucket()
Definition RuntimeAssetCacheBucket.h:23
int32 GetCurrentSize()
Definition RuntimeAssetCacheBucket.h:76
~FRuntimeAssetCacheBucket()
Definition RuntimeAssetCacheBucket.cpp:9
void AddToCurrentSize(int32 Value)
Definition RuntimeAssetCacheBucket.h:86
void Reset()
Definition RuntimeAssetCacheBucket.cpp:17
FRuntimeAssetCacheBucket(int32 InSize)
Definition RuntimeAssetCacheBucket.h:32
FCacheEntryMetadata * GetOldestEntry()
Definition RuntimeAssetCacheBucket.cpp:66
Definition ScopeLock.h:141
Definition UnrealString.h.inl:34