33namespace Statamic \Eloquent \Assets ;
44
55use Illuminate \Database \Eloquent \Model ;
6- use Illuminate \Support \Facades \Cache ;
76use Statamic \Assets \Asset as FileAsset ;
87use Statamic \Assets \AssetUploader as Uploader ;
98use Statamic \Contracts \Assets \Asset as AssetContract ;
109use Statamic \Data \HasDirtyState ;
11- use Statamic \Events \AssetUploaded ;
1210use Statamic \Facades \Blink ;
1311use Statamic \Facades \Path ;
1412use Statamic \Support \Arr ;
1513use Statamic \Support \Str ;
16- use Symfony \Component \HttpFoundation \File \UploadedFile ;
1714
1815class Asset extends FileAsset
1916{
@@ -62,8 +59,7 @@ public function meta($key = null)
6259 return $ meta ;
6360 }
6461
65- return $ this ->meta = Cache::rememberForever ($ this ->metaCacheKey (), function () {
66- $ handle = $ this ->container ()->handle ().':: ' .$ this ->metaPath ();
62+ return Blink::once ($ this ->metaCacheKey (), function () {
6763 if ($ model = app ('statamic.eloquent.assets.model ' )::where ([
6864 'container ' => $ this ->containerHandle (),
6965 'folder ' => $ this ->folder (),
@@ -72,7 +68,7 @@ public function meta($key = null)
7268 return $ model ->meta ;
7369 }
7470
75- $ this -> writeMeta ( $ meta = $ this ->generateMeta () );
71+ $ meta = $ this ->generateMeta ();
7672
7773 if (! $ meta ['data ' ]) {
7874 $ meta ['data ' ] = [];
@@ -218,24 +214,6 @@ public function move($folder, $filename = null)
218214 return $ this ;
219215 }
220216
221- /**
222- * Upload a file.
223- *
224- * @return $this
225- */
226- public function upload (UploadedFile $ file )
227- {
228- $ path = Uploader::asset ($ this )->upload ($ file );
229-
230- $ this
231- ->path ($ path )
232- ->save ();
233-
234- AssetUploaded::dispatch ($ this );
235-
236- return $ this ;
237- }
238-
239217 public function getCurrentDirtyStateAttributes (): array
240218 {
241219 return array_merge ([
0 commit comments