84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
有一个JSON数据保存在本地(约2000条数据),程序运行后会去服务器加载一个最近更新的JSON数据列表(30条,但这里可能会含有本地中已经有的数据),怎么样才可以比较高效的更新本地的JSON数据为最新?
认证高级PHP讲师
Because I don’t know the form of your data, I can only say - list storage is a linear time update, saving space and time: If it is a dictionary key-value的形式是O(1)complexity update. Trade space for time.
key-value
O(1)
If it is in k-v format, you can convert it to dict first, and then update
old = {"a":1,"b":2} new = {"a":2,"c":3} old.update(new) # old={"a":2,"b":2,"c":3}
Because I don’t know the form of your data, I can only say - list storage is a linear time update, saving space and time: If it is a dictionary
key-value
的形式是O(1)
complexity update. Trade space for time.If it is in k-v format, you can convert it to dict first, and then update