The difference between php variables and caching

recently read some tutorials on caching:
Memcache stores data as hash tables with key- > value structure;
redis can support five data types:: string (strings), hash (hash), list (list), set (collections) and zset (sorted set: ordered collections)
is obviously more powerful than Memcache, so is it necessary to use Memcache? Does it implement simple caching compared to lightweight points?
there is also an explanation based on the underlying implementation of PHP previously seen: the
php variable is implemented by the zval structure, and the address of the zval structure is stored in the symbol (hash) table, and the
global variable is stored in the symbol_table global symbol table. Then question: the
1.php variable and the Memcache cache are stored in memory, and the variable access speed should be faster than the cache. If you want to call across pages, you can define the global variable. There is no limit to the size of PHP7"s string variables, so why use caching? The
2.php variable zval structure uses five data types to store eight PHP data types, which is similar to the five data types implemented by redis.
php array is also a hash-like structure, with array functions can also achieve redis collection, list functions, can also be sorted, select access, then what is the essential difference in storing data?

Mar.06,2021

the landlord knows a lot, even the things at the bottom of php.
I don't know how the underlying php is implemented, but I think the landlord can learn about the "lifecycle of variables".

redis and memcache have different application scenarios, so they can't be compared directly. It's easy to find articles comparing them on the Internet.

The

variable is stored in memory at 00:00, and the variable does not exist after the script is executed. The cache is stored in the file or memory, and the cache is valid within the cache validity period, and the memory cache does not exist when it is restarted!


Conceptual problem,
global variable your cross-file
cache can cross requests

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bcf60a-30c60.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bcf60a-30c60.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?