I'm looking for a system to cache an already coded project (with PHP) which has features like registration and login system etc.
I have searched for some caching solutions, but I read that the logging in and posting system fails if I use such features.
What I actually need is to store results of some spesific DB queries, if there's a cache, call that results, if not generate a new cache, and re-cache them in each x minutes. (results can be stored in txt. etc).
How can I do that?
By the way, setting query_cache_type to 1 don't work. I'm looking for alternative solutions.
Thanks
The query_cache_size value is aligned to the nearest 1024 byte block. The value reported may therefore be different from the value that you assign. If the query cache size is greater than 0, the query_cache_type variable influences how it works.
The MySQL query cache is a query results cache. It compares incoming queries that start with SEL to a hash table, and if there is a match returns the results from the previous execution of the query. There are some restrictions: The query must match byte-for-byte (the query cache avoids parsing)
The query cache has been disabled-by-default since MySQL 5.6 (2013) as it is known to not scale with high-throughput workloads on multi-core machines. We considered what improvements we could make to query cache versus optimizations that we could make which provide improvements to all workloads.
Reduce Database Calls Check out phpFastCache that support WinCache, MemCache, Files, X-Cache, APC Cache. It's simple for beginners
PHP Caching Class For Database : Your website have 10,000 visitors who are online, and your dynamic page have to send 10,000 same queries to database on every page load. With phpFastCache, your page only send 1 query to DB, and use the cache to serve 9,999 other visitors.
<?php
// In your config file
include("php_fast_cache.php");
// This is Optional Config only. You can skip these lines.
// phpFastCache support "apc", "memcache", "memcached", "wincache" ,"files", "pdo", "mpdo" and "xcache"
// You don't need to change your code when you change your caching system. Or simple keep it auto
phpFastCache::$storage = "auto";
// End Optionals
// In your Class, Functions, PHP Pages
// try to get from Cache first.
$products = phpFastCache::get("products_page");
if($products == null) {
$products = YOUR DB QUERIES || GET_PRODUCTS_FUNCTION;
// set products in to cache in 600 seconds = 10 minutes
phpFastCache::set("products_page",$products,600);
}
foreach($products as $product) {
// Output Your Contents HERE
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With