Commit graph

25 commits

Author SHA1 Message Date
logmanoriginal
5de03d6b9f [FileCache] Use serialize instead of json_encode
json_encode causes high memory footprint on large input data,
where serialize is less problematic.

Example: When using AcrimedBridge items contain pictures in
raw format (entire picture) which leads to a file size of about
2MB using serialize. json_encode will allocate about 98MB of
memory for encoding, causing memory exhausion errors (PHP
allows for 128MB of memory by default)
2017-02-18 12:54:26 +01:00
logmanoriginal
1d26c7f1c3 [FileCache] Do not delete .gitkeep
This commit reduces the chance of accidentally removing the cache
folder from repository.
2017-02-18 10:23:50 +01:00
logmanoriginal
14c689e7a3 [core] Fix typos 2016-11-09 19:10:40 +01:00
Gilles Maurer
4dfbc16a5b Fix Cache write verification
PHP operator '===' is the only strict way to mix up the value '0' and
the value 'FALSE'.

The function saveData of the FileCache tests if the write of the cache
files was done with success and raise an Exception if not. The test was
done without the '===' operator, and if the data is 0 bytes long the
error message says there is a permission error, which is false.

A data 0 bytes long is another issue, either in the json_encode function
either in the Bridge, but not a permission issue.
2016-11-09 02:11:22 +01:00
logmanoriginal
82ed2c5ffb [FileCache] Change output format to JSON
JSON format does not serialize object instances, which we don't
want anyways, and improves readability. The hashing algorithm
changed to md5 to prevent collisions with existing cache files
2016-10-16 11:15:11 +02:00
logmanoriginal
5c309e93dc [cache] Specify cache duration for 'purgeCache' 2016-10-08 16:18:10 +02:00
logmanoriginal
2d56b717cf [FileCache] Add property to define cache folder 2016-10-08 16:03:08 +02:00
logmanoriginal
5639b158e7 [FileCache] Change parameters to lower-case
This prevents creating multiple cache files for the same request.
2016-10-08 15:34:19 +02:00
logmanoriginal
d941fa41f6 [FileCache] Remove 'isPrepareCache'
There is no need to check the absense of the parameters in
all functions. Instead 'getCacheName' is the only function
actually using the parameters and thus should check the
availability.
2016-10-08 15:21:10 +02:00
logmanoriginal
ac0a9a90ad [FileCache] Build file name solely on given parameters
Previously the cache file name was build on the original request URI
which also included the parameters. This could result in different
file name for the same request (different format). Removing the format
from the request is already done in index.php and could lead to issues
in the future (if new parameters are introduced).
2016-10-08 15:17:08 +02:00
logmanoriginal
5ccde61a19 [FileCache] Rename 'prepare' to 'setParameters'
This is a cosmetic change to use the same naming convention for
all methods.
2016-10-08 15:04:14 +02:00
logmanoriginal
0998cbde9d [cache] Directly implement CacheInterface in FileCache
The function 'prepare' previously implemented in CacheAbstract
is specifically required for FileCache and thus belongs to FileCache.
Since this change removes all code from CacheAbstract, it can be
removed completely.
2016-10-08 14:52:03 +02:00
logmanoriginal
5f1c4e1c55 [FileCache] Implement recursive directory creation 2016-10-07 23:20:32 +02:00
logmanoriginal
ad825aa88a [FileCache] Assign same permission to group as others
It makes no sense for the group to get less access rights
than anyone else
2016-10-07 23:16:33 +02:00
logmanoriginal
45890d5969 [FileCache] Don't store folder creation status
The results of the function is_dir are already cached.
See http://php.net/manual/en/function.is-dir.php
2016-10-07 22:56:10 +02:00
logmanoriginal
5fdb3b2fd9 [FileCache] Build path using function instead of constant 2016-10-07 22:36:36 +02:00
logmanoriginal
9ac678aac5 [Cache] Move 'purge' function to implementations
The purge function is cache specific and thus belongs
to the specific implementation.
2016-10-07 22:33:45 +02:00
logmanoriginal
51ff8de346 [Cache] Remove orphan function utf8_encode_deep 2016-10-07 22:06:58 +02:00
logmanoriginal
62eec43980 [core] Apply common indentation
All files are now using tabs for indentation
2016-09-10 20:41:11 +02:00
logmanoriginal
c2ea8d0ee9 [FileCache] Ignore 'format' when generating the file name
Previously for each requested format a new cache file was created,
though the data is the same. With this the file name no longer depends
on the requested output format.
2016-08-28 13:09:45 +02:00
logmanoriginal
d9b6477ff6 [FileCache] Fix loading cached data
Previously cached data was translated into object data (Item),
this is no longer necessary.
2016-08-22 18:59:23 +02:00
Paul de Rosanbo
e59bf64c42 Fix cache bug, the content of the cache was encoded in utf8 before
converting to json and saved, resulting in double-encoded caracters in
output
2016-01-21 14:33:58 +01:00
Teromene
259e5ef9de Casting to UTF-8 before converting to JSON. 2016-01-19 12:18:54 +00:00
teromene
2e4e89aff8 Correction of few bugs.
Warn if RSS-Bridge cannot write to disk.
Try/Catch the bridge RSS generation.

Signed-off-by: teromene <teromene@teromene.fr>
2015-12-06 15:56:39 +01:00
Yves ASTIER
927b04dfef Refonte du code 2013-08-11 13:30:41 +02:00