Phương pháp này tạo ra và mở ra một kết nối đến một máy chủ memcached chạy trên máy chủ. Các tham số cổng xác định cổng TCP được sử dụng bởi memcached, mặc định là 11211, và thời gian chờ xác định bao lâu để chờ đợi khi cố gắng để kết nối trước khi trở về FALSE. Trả về trung thực về thành công, FALSE về thất bại. ❑ memcache:: lượng giảm | Chapter 12 Memcache connect bool Memcache connect string host int port int timeout This method creates and opens a connection to a memcached server running on host. The port parameter specifies the TCP port used by memcached the default being 11211 and timeout specifies how long to wait when attempting to connect before returning FALSE. Returns true on success FALSE on failure. Memcache decrement int Memcache decrement string key int value When storing a simple numeric value in the memory cache you can actually use the decre-ment method to decrease the value matching key by the provided value. If no decrement value is specified the cached value is decremented by 1. This method returns FALSE on failure or the item s new value upon success. Memcache delete bool Memcache delete string key int timeout This method deletes the item identified by key from the memory cache. Providing a value for timeout causes the item to be deleted after the provided number of seconds. Returns FALSE on failure and TRUE on success. Memcache flush bool Memcache flush void This method tells memcached to immediately set the expiration on all items in the cache. Once this method is called any item in the cache can be overwritten by new keys but the memory is not released until that happens. This method returns TRUE on success or FALSE on failure. Memcache get string Memcache get string key string Memcache get array keys This method retrieves an item or items stored in the memory cache matching the given key or array of keys. It returns either a string or array on success depending on how many keys were provided to match against and FALSE if no keys are found matching the input parameters. Memcache getStats array Memcache getStats void This returns an array containing various bits of information regarding the status of the memory cache such as current and total connections number of cached items and server uptime. Memcache getVersion string Memcache getVersion void This returns a simple string