如何爲對象存儲上的文件設置生存時間?Softlayer對象存儲Python API生存時間
查看https://github.com/softlayer/softlayer-object-storage-python/blob/master/object_storage/storage_object.py中的代碼,它接受(自身,數據,check_md5)沒有TTL選項。
sl_storage = object_storage.get_client(
username = environment['slos_username'],
password = environment['api_key'],
auth_url = environment['auth_url']
)
# get container
sl_container = sl_storage.get_container(environment['object_container'])
# create "pointer" to cointainer file fabfile.zip
sl_file = sl_container[filename]
myzip = open(foldername + filename, 'rb')
sl_file.create()
sl_file.send(myzip, TIME_TO_LIVE_PARAM=100)
我根據https://github.com/softlayer/softlayer-object-storage-python/blob/master/object_storage/container.py
sl_file['ttl'] = timetolive
也試過,但它不工作。
謝謝!
我明白了。如果我想從對象存儲中刪除文件而不僅僅是緩存過期,我該如何指定「expires at」? – kyl
我認爲這個功能不存在,我在OpenStack http://developer.openstack.org/api-ref-objectstorage-v1.html中看不到任何東西,如果你知道如何使用softlayer對象存儲是基於open stack的話,在開放堆棧中執行它應該在softlayer中也可以工作 –