HTTP Downloader Cache.
More...
This section documents the file HTTP caching tools the GPAC framework.
◆ gf_cache_delete_entry()
void gf_cache_delete_entry |
( |
const DownloadedCacheEntry |
entry | ) |
|
Free The DownloadedCacheEntry handle
- Parameters
-
Cache should have been close before, abornormal situation
◆ gf_cache_get_etag_on_server()
const char* gf_cache_get_etag_on_server |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the ETag associated with this cache entry if any
- Parameters
-
- Returns
- The ETag if any was defined, NULL otherwise
◆ gf_cache_set_etag_on_disk()
GF_Err gf_cache_set_etag_on_disk |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char * |
eTag |
|
) |
| |
Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.
- Parameters
-
entry | The entry |
eTag | The eTag to set |
- Returns
- GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
◆ gf_cache_set_etag_on_server()
GF_Err gf_cache_set_etag_on_server |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char * |
eTag |
|
) |
| |
Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.
- Parameters
-
entry | The entry |
eTag | The eTag to set |
- Returns
- GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
◆ gf_cache_get_mime_type()
const char* gf_cache_get_mime_type |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the Mime-Type associated with this cache entry.
- Parameters
-
- Returns
- The Mime-Type (never NULL if entry is valid)
◆ gf_cache_set_mime_type()
GF_Err gf_cache_set_mime_type |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char * |
mime_type |
|
) |
| |
Set the Mime-Type in the cache. Data is duplicated, so original string can be freed by caller.
- Parameters
-
entry | The entry |
mime_type | The mime-type to set |
- Returns
- GF_OK if entry and mime-type are valid, GF_BAD_PARAM otherwise
◆ gf_cache_get_url()
const char* gf_cache_get_url |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the URL associated with this cache entry.
- Parameters
-
- Returns
- The Hash key (never NULL if entry is valid)
◆ gf_cache_can_be_cached()
Bool gf_cache_can_be_cached |
( |
const DownloadedCacheEntry |
entry | ) |
|
Tells whether a cache entry should be cached safely (no
- Parameters
-
- Returns
- 1 if entry should be cached
◆ gf_cache_get_last_modified_on_server()
const char* gf_cache_get_last_modified_on_server |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the Last-Modified information associated with this cache entry.
- Parameters
-
- Returns
- The Last-Modified header (can be NULL)
◆ gf_cache_set_last_modified_on_disk()
GF_Err gf_cache_set_last_modified_on_disk |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char * |
newLastModified |
|
) |
| |
Set the Last-Modified header for this cache entry
- Parameters
-
entry | The entry |
newLastModified | The new value to set, will be duplicated |
- Returns
- GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
◆ gf_cache_set_last_modified_on_server()
GF_Err gf_cache_set_last_modified_on_server |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char * |
newLastModified |
|
) |
| |
Set the Last-Modified header for this cache entry
- Parameters
-
entry | The entry |
newLastModified | The new value to set, will be duplicated |
- Returns
- GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
◆ gf_cache_get_cache_filename()
const char* gf_cache_get_cache_filename |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the file name of cache associated with this cache entry.
- Parameters
-
- Returns
- The Cache file (never NULL if entry is valid)
◆ gf_cache_get_cache_filesize()
u32 gf_cache_get_cache_filesize |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the real file size of the cache entry
- Parameters
-
- Returns
- the file size
◆ gf_cache_set_content_length()
GF_Err gf_cache_set_content_length |
( |
const DownloadedCacheEntry |
entry, |
|
|
u32 |
length |
|
) |
| |
Set content length of resource
- Parameters
-
entry | The entry |
length | size of the content in bytes |
- Returns
- error if any
◆ gf_cache_get_content_length()
u32 gf_cache_get_content_length |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get content length of resource
- Parameters
-
- Returns
- size of the content in bytes
◆ gf_cache_get_http_headers()
GF_Err gf_cache_get_http_headers |
( |
const DownloadedCacheEntry |
entry, |
|
|
const char ** |
etag, |
|
|
const char ** |
last_modif |
|
) |
| |
Get directives headers associated with the cache
- Parameters
-
entry | The entry of cache to use |
etag | set to etag value or NULL if no cache |
last_modif | set to last modif value or NULL if no cache |
- Returns
- GF_OK if everything went fine, GF_BAD_PARAM if parameters are wrong
◆ gf_cache_get_size()
u64 gf_cache_get_size |
( |
const char * |
directory | ) |
|
Computes the size of the cache elements in directory
- Parameters
-
directory | containing cache files |
- Returns
- size in bytes
◆ gf_cache_cleanup()
u64 gf_cache_cleanup |
( |
const char * |
directory, |
|
|
u32 |
max_size |
|
) |
| |
Delete all cached files in given directory starting with startpattern
- Parameters
-
directory | to clean up |
max_size | max size to achieve |
- Returns
- total number of bytes in cache after cleanup
◆ gf_cache_entry_set_delete_files_when_deleted()
void gf_cache_entry_set_delete_files_when_deleted |
( |
const DownloadedCacheEntry |
entry | ) |
|
Mark associated files as "to be deleted" when the cache entry is removed
- Parameters
-
◆ gf_cache_entry_is_delete_files_when_deleted()
Bool gf_cache_entry_is_delete_files_when_deleted |
( |
const DownloadedCacheEntry |
entry | ) |
|
Check if associated files is marked as "to be deleted" when the cache entry is removed
- Parameters
-
- Returns
- GF_TRUE if cache entry is flaged as "to be deleted"
◆ gf_cache_get_sessions_count_for_cache_entry()
u32 gf_cache_get_sessions_count_for_cache_entry |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the number of sessions for a cache entry
- Parameters
-
- Returns
- the number of sessions using this cache entry
◆ gf_cache_get_start_range()
u64 gf_cache_get_start_range |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the start range of a cache entry
- Parameters
-
- Returns
- the start range in bytes
◆ gf_cache_get_end_range()
u64 gf_cache_get_end_range |
( |
const DownloadedCacheEntry |
entry | ) |
|
Get the end range of a cache entry
- Parameters
-
- Returns
- the end range in bytes
◆ gf_cache_are_headers_processed()
Bool gf_cache_are_headers_processed |
( |
const DownloadedCacheEntry |
entry | ) |
|
Check if the entry is marked as "headers processed" (reply headers have been parsed)
- Parameters
-
- Returns
- GF_TRUE if the entry is marked
◆ gf_cache_set_headers_processed()
GF_Err gf_cache_set_headers_processed |
( |
const DownloadedCacheEntry |
entry | ) |
|
Mark the entry as "headers processed"
- Parameters
-
- Returns
- error if any