-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbf1a2f
commit 4bf5a1f
Showing
6 changed files
with
104 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
{ | ||
"name": "rodrigopedra/russian-doll-caching", | ||
"description": "Laravel Russian Doll Caching", | ||
"keywords": ["russian doll caching", "rodrigopedra", "laravel"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Rodrigo Pedra Brum", | ||
"email": "[email protected]" | ||
"name": "rodrigopedra/russian-doll-caching", | ||
"description": "Laravel Russian Doll Caching", | ||
"keywords": [ | ||
"russian doll caching", | ||
"rodrigopedra", | ||
"laravel" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Rodrigo Pedra Brum", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"illuminate/contracts": "~5.3|~5.4|~5.5|~5.6", | ||
"illuminate/support": "~5.3|~5.4|~5.5|~5.6" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"RodrigoPedra\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"RodrigoPedra\\RussianDollCaching\\RussianDollCachingServiceProvider" | ||
] | ||
} | ||
} | ||
], | ||
"require": { | ||
"illuminate/support": "~5.1|~5.2", | ||
"illuminate/database": "~5.1|~5.2", | ||
"illuminate/cache": "~5.1|~5.2", | ||
"nesbot/carbon": "~1.19" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"RodrigoPedra\\": "src/" | ||
} | ||
}, | ||
"minimum-stability": "dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/RussianDollCaching/Traits/RussianCacheableCollection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace RodrigoPedra\RussianDollCaching\Traits; | ||
|
||
trait RussianCacheableCollection | ||
{ | ||
/** | ||
* Calculate a unique cache key for the model instance. | ||
*/ | ||
public function getCacheKey() | ||
{ | ||
return sprintf( "%s/%s", | ||
get_class( $this ), | ||
md5( $this->toJson() ) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace RodrigoPedra\RussianDollCaching\Traits; | ||
|
||
trait RussianCacheableModel | ||
{ | ||
/** | ||
* Calculate a unique cache key for the model instance. | ||
*/ | ||
public function getCacheKey() | ||
{ | ||
return sprintf( "%s/%s-%s", | ||
get_class( $this ), | ||
$this->getKey(), | ||
$this->updated_at->timestamp | ||
); | ||
} | ||
} |