Does the image belong to a resource? if so, how can I store the image in redis/memcached memory?

Source: Internet
Author: User
Redismemcached cannot store resources in the cache. is an image a resource? Is there a way to store images in the server memory, just like normal data. (Not the front-end expires cache, but the server memory cache must exist.) redis/memcached cannot store resources (resources in the cache). is the image a resource?

Is there a way to store images in the server memory, just like normal data.

(The expires cache must exist in the server memory cache instead of the frontend expires cache)

Reply content:

Redis/memcached cannot store resources in the cache. is an image a resource?

Is there a way to store images in the server memory, just like normal data.

(The expires cache must exist in the server memory cache instead of the frontend expires cache)

Directly read the image file and put it in redis.
Redis is binary secure and can be safely stored.



  Set ('IMG ', $ img); // show. php $ img = $ redis-> get ('IMG '); header ('content-Type: image/png '); // you may change image/png to image/jpeg if you pic is jpeg. header ('content-Length :'. strlen ($ img); echo $ img;

Convert an imageBase64And then store the data in redis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.