File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed
src/Symfony/Component/Cache/Traits Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -105,22 +105,26 @@ public function hasItem($key)
105
105
public function clear ()
106
106
{
107
107
$ this ->deferred = array ();
108
- try {
109
- if ($ cleared = $ this ->versioningIsEnabled ) {
110
- $ namespaceVersion = 2 ;
111
- try {
112
- foreach ($ this ->doFetch (array ('@ ' .$ this ->namespace )) as $ v ) {
113
- $ namespaceVersion = 1 + (int ) $ v ;
114
- }
115
- } catch (\Exception $ e ) {
108
+ if ($ cleared = $ this ->versioningIsEnabled ) {
109
+ $ namespaceVersion = 2 ;
110
+ try {
111
+ foreach ($ this ->doFetch (array ('@ ' .$ this ->namespace )) as $ v ) {
112
+ $ namespaceVersion = 1 + (int ) $ v ;
116
113
}
117
- $ namespaceVersion .= ': ' ;
114
+ } catch (\Exception $ e ) {
115
+ }
116
+ $ namespaceVersion .= ': ' ;
117
+ try {
118
118
$ cleared = $ this ->doSave (array ('@ ' .$ this ->namespace => $ namespaceVersion ), 0 );
119
- if ($ cleared = true === $ cleared || array () === $ cleared ) {
120
- $ this ->namespaceVersion = $ namespaceVersion ;
121
- }
119
+ } catch (\Exception $ e ) {
120
+ $ cleared = false ;
121
+ }
122
+ if ($ cleared = true === $ cleared || array () === $ cleared ) {
123
+ $ this ->namespaceVersion = $ namespaceVersion ;
122
124
}
125
+ }
123
126
127
+ try {
124
128
return $ this ->doClear ($ this ->namespace ) || $ cleared ;
125
129
} catch (\Exception $ e ) {
126
130
CacheItem::log ($ this ->logger , 'Failed to clear the cache ' , array ('exception ' => $ e ));
You can’t perform that action at this time.
0 commit comments