UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RuntimeAssetCacheBackend.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"
7#include "UObject/NameTypes.h"
8
9class FArchive;
12
16
21{
22public:
28 {
29 static FRuntimeAssetCacheBackend& Backend = *CreateBackend();
30 return Backend;
31 }
32
40 FCacheEntryMetadata* GetCachedData(FName Bucket, const TCHAR* CacheKey, void*& OutData, int64& OutDataSize);
41
50 bool PutCachedData(FName Bucket, const TCHAR* CacheKey, void* InData, int64 InDataSize, FCacheEntryMetadata* Metadata);
51
58 virtual bool RemoveCacheEntry(FName Bucket, const TCHAR* CacheKey) = 0;
59
64 virtual bool ClearCache() = 0;
65
71 virtual bool ClearCache(FName Bucket) = 0;
72
80
81protected:
82 /*
83 * Virtual destructor.
84 */
86
87 /*
88 * Creates archive to read data from.
89 * @param Bucket Bucket containing cache entry.
90 * @param CacheKey Key to cache entry.
91 * @return Archive storing data.
92 */
93 virtual FArchive* CreateReadArchive(FName Bucket, const TCHAR* CacheKey) = 0;
94
95 /*
96 * Creates archive to write data into.
97 * @param Bucket Bucket containing cache entry.
98 * @param CacheKey Key to cache entry.
99 * @return Archive storing data.
100 */
101 virtual FArchive* CreateWriteArchive(FName Bucket, const TCHAR* CacheKey) = 0;
102
103 /*
104 * Preloads metadata from archive.
105 * @param Ar Archive to load metadata from
106 * @return Metadata.
107 */
109
110private:
115 static FRuntimeAssetCacheBackend* CreateBackend();
116
117};
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
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
Definition Archive.h:1208
Definition RuntimeAssetCacheEntryMetadata.h:16
Definition NameTypes.h:617
Definition UnrealTemplate.h:321
Definition RuntimeAssetCacheBackend.h:21
virtual bool RemoveCacheEntry(FName Bucket, const TCHAR *CacheKey)=0
virtual FArchive * CreateWriteArchive(FName Bucket, const TCHAR *CacheKey)=0
static FRuntimeAssetCacheBackend & Get()
Definition RuntimeAssetCacheBackend.h:27
virtual bool ClearCache()=0
virtual bool ClearCache(FName Bucket)=0
bool PutCachedData(FName Bucket, const TCHAR *CacheKey, void *InData, int64 InDataSize, FCacheEntryMetadata *Metadata)
Definition RuntimeAssetCacheBackend.cpp:29
FCacheEntryMetadata * PreloadMetadata(FArchive *Ar)
Definition RuntimeAssetCacheBackend.cpp:50
virtual ~FRuntimeAssetCacheBackend()
Definition RuntimeAssetCacheBackend.h:85
virtual FRuntimeAssetCacheBucket * PreLoadBucket(FName BucketName, int32 BucketSize)=0
FCacheEntryMetadata * GetCachedData(FName Bucket, const TCHAR *CacheKey, void *&OutData, int64 &OutDataSize)
Definition RuntimeAssetCacheBackend.cpp:8
virtual FArchive * CreateReadArchive(FName Bucket, const TCHAR *CacheKey)=0
Definition RuntimeAssetCacheBucket.h:20