What I need is : I am using glide to show images in my app. I need to set a expiry time for cached images in glide. I understand that we can use signature(Which is now changed as GlideImageVersion). I found that to set expiry for 600 seconds, I have used "System.currentTimeMillis()/(1000 * 60 *10)".
EDIT : Expiry technically means, I need to set a value for signature and that value should not change for 3,628,800 seconds (60,480 minutes).
For 600 seconds:
currentTime = System.currentTimeMillis()
ExpiryFor10mins = currentTime / (1000*60*10) //For 10 minutes
Glide.with(getActivity())
.load(mUser.getCoverPhoto())
.error(R.drawable.bg_1)
.signature(new StringSignature(ExpiryFor10mins.toInt())
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
mTextBioOther.setVisibility(!isMe ? View.VISIBLE : View.GONE);
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
mTextBioOther.setVisibility(!isMe ? View.VISIBLE : View.GONE);
return false;
}
})
.into(mImageCover);
But I need to set this cache expiry for 3,628,800 seconds, which is for 6 weeks. Can anyone help to figure out the Math for this? Thanks in advance...