Comments (9)
Thank you for your feedback. Can't agree more on that.
I removed my static config/item functions and added my own config and item classes to stay with the design choices that are made.
from phpfastcache.
Hello curious contributor !
Since it seems to be your first contribution, make sure that you've been:
- Reading and searching out our WIKI
- Reading and agreed with our Code Of Conduct
- Reading and understood our Coding Guideline
- Reading our README
If everything looks unclear to you, tell us what π
The Phpfastcache Team
from phpfastcache.
Hello,
The sub-directory is necessary for security reason, so it won't be removed/.
Its purpose is to avoid hosts/shared website cache collisions.
Cheers,
Georges
from phpfastcache.
The host/shared website collisions is only when the tmp directory is used?
What I mean is. In mine setup each project/website has it's own cache directory already. Having those extra 2 directories seems off when a custom path is set.
I totally understand it when the default tmp directory is used.
from phpfastcache.
I did overwrite the Files driver and changed it the way I needed.
I will leave example behind if anyone else ever need it.
Removed by @Geolim4 for security concerns.
Using it:
CacheManager::addCoreDriverOverride(
'Files',
\Cache\Files::class
);
$cache = new Psr16Adapter('Files', new FilesConfig([
'path' => '/some/directory',
'autoTmpFallback' => false
]);
What I did notice is that there might be a bug with incorrectly calling "getItemClass". When I set this hard coded to the existing Files\Item class like I did with the config class it keeps searching in the directory were my custom files driver is saved.
I think in CacheItemPoolTrait line 74 and 135 the calling with "self" need to be changed to "static".
self::getItemClass() => static::getItemClass()
from phpfastcache.
The host/shared website collisions is only when the tmp directory is used?
What I mean is. In mine setup each project/website has it's own cache directory already. Having those extra 2 directories seems off when a custom path is set.
I totally understand it when the default tmp directory is used.
No, I've already seen collision risks when people are using multiple files driver-based in the same directory: Ex: Sqlite and Files.
If you don't make a sub-directory, some CRUD operations (e.g: clear cache) will impact others drivers.
That's why the sub-directory is necessary.
from phpfastcache.
I think in CacheItemPoolTrait line 74 and 135 the calling with "self" need to be changed to "static".
self::getItemClass() => static::getItemClass()
Its not needed as this is a core feature not meant to be overridden. Also static
keyword have a performance issue since it is JIT-evaluated while self
is lexer-evaluated.
from phpfastcache.
I do understand your concern. I'm ok with my work around because I only use one adapter for one specific job.
Did you notice any performance problems with self/static? Isn't it called once when creating the driver? Just curious..
from phpfastcache.
I do understand your concern. I'm ok with my work around because I only use one adapter for one specific job.
Did you notice any performance problems with self/static? Isn't it called once when creating the driver? Just curious..
It is also called here:
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php:135
lib/Phpfastcache/Cluster/ClusterPoolAbstract.php:193
So it is called every time you need a cache item. On big project this can have a significant impact.
I'm on philosophy anyway to have any php engine optimizations: isset instead of array_key_exists, fully qualified php core functions, self instead of static where it applies, static closure where it applies, etc.
It's all those micro-optimizations that end to noticeable optimization in the end.
from phpfastcache.
Related Issues (20)
- Cloudflare - Cache Reserve R2 | Object Storage Driver HOT 7
- Website broken - Unable to browse any documentation page HOT 6
- PDO Cache is case insensitive? HOT 4
- Proper way to preload cache items with crontab HOT 14
- Memcached driver compress_data cache miss HOT 4
- Config('path') - Can't declare path from the parent directory of index file directory. HOT 6
- Installation fails: 'Fatal error: Uncaught Error: Class "CacheManager" not found ...' HOT 3
- getItemsByTag() - empty after one item has expired HOT 10
- CanΒ΄t retrieve phpfastcache 9.1.3 thru composer HOT 7
- Saving an item that is already in the pool after its expiration time fails HOT 13
- 2 million data cache? HOT 5
- Storing and retrieving mysql result arrays using Psr16Adapter HOT 4
- Deleting cache by tag without loading all its cache HOT 3
- cache not clearing manually in html HOT 2
- Cache clear() not working with Redis, getItem() still returns data HOT 2
- How to use memcache on v8 ? HOT 3
- Support custom native RedisCluster client HOT 9
- TypeError Phpfastcache\Drivers\Files\Driver::driverRead(): Return value must be of type ?array, bool returned HOT 13
- Memory size exhausted by deleting by Tags HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpfastcache.