We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
通过缓存的图片元数据, 如md5结合size来查询是否图片存在于服务器
md5
size
用例: 用户可仅缓存图片元数据而非源文件, 发送已缓存图片时查询缓存是否还有效 有效则直接通过md5, 即imageId构建, 无效则下载源文件发送并重新缓存元数据, 对于色图Bot而言可节省一大笔硬盘开销
imageId
Bot
另一用法为真实案例: 维护由用户设置的关键词回复时, 可仅缓存用户发送的图片元数据进数据库而非下载保存整个图片 触发回复时检测缓存是否有效, 如已失效则删除记录
目前onebot-mirai通过反射调用GroupPicUp判断FileExists和RequireUpload来检测缓存是否有效
onebot-mirai
GroupPicUp
FileExists
RequireUpload
The text was updated successfully, but these errors were encountered:
可以自行实现 ExternalResource 并将 inputStream 策略调整为 lazy 然后调用 uploadImage
ExternalResource
inputStream
lazy
uploadImage
Sorry, something went wrong.
现在可以自行实现 ExternalResource 接口,实现其 size 和 md5,其余属性直接抛出一个特定异常。用该 resource 发送图片,捕获到特定异常就表示图片已过期,无异常则是图片还未过期。
可以设计一个API查询服务器上面有无某个ExternalResource。
Support Image.isUploaded,
Image.isUploaded
7e2e104
add member `Image.md5`, add `Image.calculateImageMd5ByImageId`, close #1401
Support Image.isUploaded, (#1671)
bd041e4
* Support `Image.isUploaded`, add member `Image.md5`, add `Image.calculateImageMd5ByImageId`, close #1401 * Update docs
Successfully merging a pull request may close this issue.
通过缓存的图片元数据, 如
md5
结合size
来查询是否图片存在于服务器用例:
用户可仅缓存图片元数据而非源文件, 发送已缓存图片时查询缓存是否还有效
有效则直接通过
md5
, 即imageId
构建, 无效则下载源文件发送并重新缓存元数据, 对于色图Bot
而言可节省一大笔硬盘开销另一用法为真实案例:
维护由用户设置的关键词回复时, 可仅缓存用户发送的图片元数据进数据库而非下载保存整个图片
触发回复时检测缓存是否有效, 如已失效则删除记录
目前
onebot-mirai
通过反射调用GroupPicUp
判断FileExists
和RequireUpload
来检测缓存是否有效The text was updated successfully, but these errors were encountered: