Skip to content

Conversation

@tang3w
Copy link
Contributor

@tang3w tang3w commented Oct 17, 2018

支持了 Installation 及其缓存。目前 currentInstallation 是 Application 的一个属性。

@zapcannon87

@tang3w
Copy link
Contributor Author

tang3w commented Oct 17, 2018

忽然想起由于服务端的一个限制,Installation 不允许 PUT 请求,还得做一下特殊处理。

@tang3w
Copy link
Contributor Author

tang3w commented Oct 17, 2018

已经做了特殊处理。


let name = "StorageContext"

var type = LocalStorageType.fileCacheOrMemory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉 filePersistent 更好?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

又想了一下,还是 fileCacheOrMemory 吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我也犹豫过。我主要考虑到 API 对 installation 已经做了基于 device token 的校验和插入,用 fileCacheOrMemory 好像更合适一些。但是如果把 currentUser 也存到 storage context 里面,用 fileCacheOrMemory 好像就不太合适了,因为可能会被系统清理。

要不还是改为 filePersistent 吧?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

依据官方的 guideline 来看,感觉 installation 的缓存属于 2 类型,放 /Library/Caches 就行;user 的缓存属于 1 类型,持久并可以被备份。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也行,后面把它俩分开放吧。

@zapcannon87
Copy link
Contributor

zapcannon87 commented Oct 17, 2018

LGTM

Approved with PullApprove

@tang3w tang3w merged commit 5b0d1bb into leancloud:master Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants