azure-data-lakedata-lake

Create a file in DataLake and make it expire after 2 minutes


I am using Data Lake Gen 1 and i would like to create a file and set the expiration time to be 2 minutes after creation.

I am using this method:

public virtual System.Threading.Tasks.Task SetExpiryTimeAsync (string path, Microsoft.Azure.DataLake.Store.ExpiryOption eopt, long expiryTime, System.Threading.CancellationToken cancelToken = null);

like this:

await client.SetExpiryTimeAsync(fileDestinationPath, ExpiryOption.RelativeToNow, _adlsFileExpirationInMinutes);

I could not find how the parameter long expiryTime works. In MSDN it says "It's interpretation depends on what ExpiryOption user passes".

What I do not understand is that this value is a long: what does it represents: seconds, ticks, hours...?


Solution

  • It represents milliseconds, you can find this information from the sync method SetExpiryTime. The following is the screenshot I get from the sdk via visual studio:

    enter image description here

    A little more information, from the source code of Azure Data lake here, the sync-mothed SetExpiryTime actually does nothing but just calls the async-method SetExpiryTimeAsync inside, so both of them have the same parameter definition:

    enter image description here