4
$\begingroup$

I want to create cloud objects that are only available for about a day. Can I somehow automate the deletion by setting some kind of timer somewhere?

As far as I understand it, everytime I use CloudExport[] the resulting object stays in the cloud until I manually delete it.

Best, Max

$\endgroup$
6
  • $\begingroup$ afaic you need at least the developer plan and run appropriate scheduled task after deployment. In case of storing expressions you could experiment with PersistentValue or Databin both of which have expiration date setting. Another way could be to deploy a Delayed HTTPRedirect object which only redirects to the source before the expiration date. Not neat and it sill is there but something to think about. $\endgroup$
    – Kuba
    Jul 18, 2018 at 11:24
  • $\begingroup$ Is there an overview somewhere about the functionalities with other plans? $\endgroup$
    – MaxJ
    Jul 18, 2018 at 12:27
  • $\begingroup$ wolfram.com/development-platform/pricing $\endgroup$
    – Kuba
    Jul 18, 2018 at 13:34
  • $\begingroup$ I can not find anything about scheduled tasks on the page you posted. Is it hidden on the page somewhere? $\endgroup$
    – MaxJ
    Jul 18, 2018 at 14:30
  • $\begingroup$ There's a lot of subtle differences between the plans. ScheduledTasks are one of the things that differs a lot between pricing levels. The pricing page doesn't really cover everything in detail. $\endgroup$
    – Searke
    Jul 18, 2018 at 16:24

1 Answer 1

1
$\begingroup$

I'm not sure about this, as I have not used it myself, but from the documentation for PersistenceLocation

PersistenceLocation["Cloud"];

PersistentValue["b2", PersistenceTime -> Quantity[1, "Days"]] = 55;

or for objects

ClearAll[po];

po = PersistentObject["myob", "Cloud"];

po["ExpirationDate"] = Now + Quantity[1, "Days"];

po["Value"] = 17
(* 17 *)

Through@PersistentObjects[All, "Cloud"][All]
(* {<|"HeldValue" -> Hold[17], 
  "CreationDate" -> 3.7409028803224120*10^9, "Creator" -> "Rodolfo", 
  "ModificationDate" -> 3.7409028870557971*10^9, 
  "LanguageVersion" -> 11.3, 
  "ExpirationDate" -> 3.7409892791783465*10^9, 
  "MergingFunction" -> Automatic, 
  "ValuePreprocessingFunction" -> Automatic|>} *)
$\endgroup$
4
  • $\begingroup$ Being experimental functionality, I would not be surprised if the PersistenceTime feature only applied to local objects - I guess I should try it out. $\endgroup$
    – Searke
    Jul 18, 2018 at 16:30
  • 1
    $\begingroup$ It works! given that it does, I'm really surprised the option PersistenceTime wasn't extended for CloudObjects in general. $\endgroup$
    – Searke
    Jul 18, 2018 at 16:39
  • $\begingroup$ @Searke I'm glad it helped. $\endgroup$
    – rhermans
    Jul 18, 2018 at 16:41
  • $\begingroup$ @Searke does it work with APIs, Forms, ScheduledTasks? If it works only with values then it does not really works with CloudObjects but PersistentValues. $\endgroup$
    – Kuba
    Aug 17, 2018 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.