Home > Backend Development > PHP Tutorial > A brief analysis of php's apc extension (4)

A brief analysis of php's apc extension (4)

WBOY
Release: 2016-07-29 09:15:00
Original
1128 people have browsed it

Before introducing the "System Cache Entries" and "User Cache Entries" pages, let's review the setting of account and password mentioned in (1). What is the use of this account password? In fact, it is used for these two pages. When we are not logged in, when viewing "System Cache Entries", the specific path information of the cache file will be hidden, and "User Cache Entries" will prompt you to view user variables. You need to log in. After logging in, the specific path of the cached file and the user's cached variable information will be displayed. The login button is on the upper right side of the page. Click "Login" and enter the set account and password to log in successfully.

A brief analysis of phps apc extension (4)

A brief analysis of phps apc extension (4)

“System Cache Entries”: This page records all cached php files.

1 Script Filename: cached script file path and name

2 Hits: number of hits

3 Size: cache file size (this value is not the size of the computer occupied by the file, but the size of the apc shared memory block occupied)

4 Last accessed: The last access time of the file

5 Last Modified: The last modified time of the file

6 Created at: The cache file creation time

7 Deleted at: The cache file deletion time

A brief analysis of phps apc extension (4)

“User Cache Entries”: User Cache and system cache page parameters are roughly the same. Different parameters are listed below, and parameters with the same meaning will not be explained.

1 User Entry Label: The key value of the user cache variable.

2 Timeout: The expiration time of user cache variables.

3 Deleted at: Click "Delete Now" to manually delete a single user cache variable.

A brief analysis of phps apc extension (4)

Unlike the system cache, the user cache requires the user to manually add and obtain it. Here we need to use some functions provided by apc. Here are some commonly used functions.

1 apc_add(): Only cache variables to the data store if the cached variables do not exist. The name key used to store cache variables is unique, so trying to use apc_add() to add a cache with an existing name will not overwrite the existing cache value, and return false.

2 apc_store(): Cache a variable into apc. The name key used to store cache variables is unique, so if two values ​​use the same key, the original one will be overwritten by the new value.

3 apc_fetch(): Get the corresponding cache value based on the key.

4 apc_exists(): Check whether the key exists.

5 apc_delete(): Delete a variable from the data storage.

6 apc_clear_cache(): Clear user or system cache.

Summary:

1 After logging in, benefit 1: you can view the specific path of the cache file; benefit 2: you can view user cache variable information; benefit 3: you can clear the system cache and user cache.

2 Both apc_add and apc_store cache a variable into apc. The difference is that when apc_add() adds a cache with an existing name, it will not overwrite the existing cache value and return false. apc_store() will overwrite the original cache value.

The above has introduced a brief analysis of PHP's apc extension (4), including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template