pandemonium_engine/modules/web/doc_classes/FileCache.xml

104 lines
3.6 KiB
XML
Raw Normal View History

2022-08-21 00:40:49 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-06-13 17:34:41 +02:00
<class name="FileCache" inherits="Reference" version="3.12">
2022-08-21 00:40:49 +02:00
<brief_description>
The FileCache class provide functionality for file and directory caching for the web module.
2022-08-21 00:40:49 +02:00
</brief_description>
<description>
The FileCache class provide functionality for file and directory caching for the web module.
It can evaluate a folder, and save all file paths into memory.
Using this functionality can increase performance in certain scenarios, as the application does not have to use a syscall to evaluate whether a file exists or not, and also helps with avoiding directory traversal attacks, as relative paths are not going to be expanded by accident.
(A directory traversal attach would be if an application receives this get request: [code]server.net/../../../etc/passwd[/code], and it would result in success, if the app then returns the contents of the "passwd" file, which is outside of the root folder of the server.)
[FileCache] has a drawback for now, as it doesn't yet watch for changes in the folder, so if files change it needs to be manually refreshed.
It can also save contents of files into memory if needed using the [code]set_cached_body()[/code] helper method.
2022-08-21 00:40:49 +02:00
</description>
<tutorials>
</tutorials>
<methods>
<method name="clear">
<return type="void" />
<description>
</description>
</method>
<method name="get_cached_body">
<return type="String" />
<argument index="0" name="path" type="String" />
<description>
</description>
</method>
2023-01-14 13:38:58 +01:00
<method name="get_wwwroot_abs">
<return type="String" />
<description>
</description>
</method>
2022-08-21 00:40:49 +02:00
<method name="has_cached_body">
<return type="bool" />
<argument index="0" name="path" type="String" />
<description>
</description>
</method>
<method name="set_cached_body">
<return type="void" />
<argument index="0" name="path" type="String" />
<argument index="1" name="body" type="String" />
<description>
</description>
</method>
<method name="wwwroot_deregister_file">
<return type="void" />
<argument index="0" name="file_path" type="String" />
<description>
</description>
</method>
<method name="wwwroot_evaluate_dir">
<return type="void" />
<argument index="0" name="file_path" type="String" />
<argument index="1" name="should_exist " type="bool" default="true" />
<description>
</description>
</method>
2023-01-14 13:38:58 +01:00
<method name="wwwroot_get_file_index">
<return type="int" />
<argument index="0" name="file_path" type="String" />
<description>
</description>
</method>
<method name="wwwroot_get_file_orig_path">
<return type="String" />
<argument index="0" name="index" type="int" />
<description>
</description>
</method>
<method name="wwwroot_get_file_orig_path_abs">
<return type="String" />
<argument index="0" name="index" type="int" />
<description>
</description>
</method>
2022-08-21 00:40:49 +02:00
<method name="wwwroot_has_file">
<return type="bool" />
<argument index="0" name="file_path" type="String" />
<description>
</description>
</method>
<method name="wwwroot_refresh_cache">
<return type="void" />
<description>
</description>
</method>
<method name="wwwroot_register_file">
<return type="void" />
<argument index="0" name="file_path" type="String" />
<description>
</description>
</method>
</methods>
<members>
<member name="cache_invalidation_time" type="int" setter="set_cache_invalidation_time" getter="get_cache_invalidation_time" default="0">
</member>
<member name="wwwroot" type="String" setter="set_wwwroot" getter="get_wwwroot" default="&quot;&quot;">
</member>
</members>
<constants>
</constants>
</class>