如何使用java / spring将图像存储到redis [英] how to store an image to redis using java / spring

查看:1691
本文介绍了如何使用java / spring将图像存储到redis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的图片上传服务器上使用redis和spring框架。我需要将图像存储到redis。我发现了以下问题,但它是用于python。

如何存储图像使用python / PIL进入redis

I'm using redis and spring framework on my image upload server. I need to store the images to redis. I have found the following question but it was for python.
how to store an image into redis using python / PIL

我不确定这是不是最好的方法,但我想知道如何在java中做到这一点(最好使用春天框架)。我正在使用使用jedis的spring-data-redis。

I'm not sure if it's the best way but I would like to know how to do it in java (preferably using spring framework). I'm using spring-data-redis which uses jedis.

我想知道在redis中存储图像是否是一个很好的策略。

I would like to know if it is a good strategy to store images in redis.

推荐答案

Redis是二进制安全的,因此,对于Jedis,您可以使用BinaryJedis存储二进制数据,就像存储任何其他类型的值一样在Redis。

Redis is binary safe so, in the case of Jedis, you can use BinaryJedis to store binary data just as any other kind of value that you store in Redis.

不,我不认为在Redis中存储图像,因此在内存中存储图像是一个很好的策略。那必须是一个非常特殊的用例。

And no, I don't think storing images in Redis, and thus in-memory, is a good strategy. That would have to be a very special use-case.

这篇关于如何使用java / spring将图像存储到redis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆