Clear offer sorting cache by price
504437
protected function clearProductSortingByPrice()
    {
        ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_ASC);
        ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_DESC);

        //Get price types
        $obPriceTypeList = PriceType::active()->get();
        if ($obPriceTypeList->isEmpty()) {
            return;
        }

        foreach ($obPriceTypeList as $obPriceType) {
            ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_ASC.'|'.$obPriceType->code);
            ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_DESC.'|'.$obPriceType->code);
        }
    }
1193846
def clear(self):
        
        self._filters = []
        self._order_by = OrderedDict()
        self._selects = set()
        self._negation = False
        self._attribute = None
        self._chain = None
        self._search = None

        return self
1333451
@Override
	public void clearCache(CommerceOrderNote commerceOrderNote) {
		entityCache.removeResult(CommerceOrderNoteModelImpl.ENTITY_CACHE_ENABLED,
			CommerceOrderNoteImpl.class, commerceOrderNote.getPrimaryKey());

		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		clearUniqueFindersCache((CommerceOrderNoteModelImpl)commerceOrderNote,
			true);
	}
242647
def clear(self, asset_manager_id):
        
        self.logger.info('Clear Market Data - Asset Manager: %s', asset_manager_id)
        url = '%s/clear/%s' % (self.endpoint, asset_manager_id)
        response = self.session.delete(url)
        if response.ok:
            eod_price_count = response.json().get('eod_price_count', 'Unknown')
            self.logger.info('Deleted %s EOD Prices.', eod_price_count)
            fx_rate_count = response.json().get('fx_rate_count', 'Unknown')
            self.logger.info('Deleted %s FX Rates.', fx_rate_count)
            return response.json()
        else:
            self.logger.error(response.text)
            response.raise_for_status()
1339546
@Override
	public void clearCache() {
		entityCache.clearCache(CommerceWishListImpl.class);

		finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}
200237
def clean(self, data):
        """"""
        cleaned_data = list()

        if not isinstance(data, list):
            data = [data]

        for item in data:
            date = datetime.datetime.strptime(item['Date'], '%Y-%m-%d').date()
            cleaned_data.append(dict(price=item['Adj_Close'], date=date))

        return cleaned_data
95013
@Override
	public void clearCache(
		CommerceShippingFixedOption commerceShippingFixedOption) {
		entityCache.removeResult(CommerceShippingFixedOptionModelImpl.ENTITY_CACHE_ENABLED,
			CommerceShippingFixedOptionImpl.class,
			commerceShippingFixedOption.getPrimaryKey());

		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}
1231732
public function ClearSearchCacheTables()
    {
        $sQuery = 'TRUNCATE TABLE `shop_search_cache_item`';
        \MySqlLegacySupport::getInstance()->query($sQuery);
        $sQuery = 'TRUNCATE TABLE `shop_search_cache`';
        \MySqlLegacySupport::getInstance()->query($sQuery);
    }
595144
static function clearSortKey( $cacheItem )
    {
        $cachePath = eZSys::cacheDirectory();

        $fileHandler = eZClusterFileHandler::instance();
        $fileHandler->fileDelete( $cachePath, 'sortkey_' );
    }
1267172
function (callback, term, from, size, sort, specs, ids, brands, categories, prices, dsl) {
        var host = apiSearch
        // proxy will pass XGET
        // var method = 'POST'
        var endpoint = '/items.json'
        var body

        if (typeof dsl === 'object' && dsl !== null) {
          // custom Query DSL
          // must be a valid search request body
          // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html
          body = dsl
        } else {
          /*
          // term is required
          if (typeof term !== 'string') {
            msg = 'Search term is required and must be a string'
            errorHandling(callback, msg)
            return
          }
          */

          // handle results sorting
          var order = [
            {
              'available': {
                'order': 'desc'
              }
            },
            {
              'ad_relevance': {
                'order': 'desc'
              }
            },
            '_score'
          ]

          // defines most common sorting options
          switch (sort) {
            case 1:
              // sort by sales after relevance
              order.splice(2, 0, {
                'sales': {
                  'order': 'desc'
                }
              })
              break

            case 2:
              // sort by price
              // lowest price -> highest price
              order.splice(1, 0, {
                'price': {
                  'order': 'asc'
                }
              })
              break

            case 3:
              // sort by price
              // highest price -> lowest price
              order.splice(1, 0, {
                'price': {
                  'order': 'desc'
                }
              })
              break

            default:
              // default sort by views after preseted sorting options
              order.push({
                'views': {
                  'order': 'desc'
                }
              })
          }

          body = {
            'query': {
              'bool': {
                // condition, only visible products
                'filter': [
                  {
                    'term': {
                      'visible': true
                    }
                  }
                ]
              }
            },
            'sort': order,
            'aggs': {
              'brands': {
                'terms': {
                  'field': 'brands.name'
                }
              },
              'categories': {
                'terms': {
                  'field': 'categories.name'
                }
              },
              // ref.: https://github.com/elastic/elasticsearch/issues/5789
              'specs': {
                'nested': {
                  'path': 'specs'
                },
                'aggs': {
                  'grid': {
                    'terms': {
                      'field': 'specs.grid',
                      'size': 30
                    },
                    'aggs': {
                      'text': {
                        'terms': {
                          'field': 'specs.text'
                        }
                      }
                    }
                  }
                }
              },
              // Metric Aggregations
              'min_price': {
                'min': {
                  'field': 'price'
                }
              },
              'max_price': {
                'max': {
                  'field': 'price'
                }
              },
              'avg_price': {
                'avg': {
                  'field': 'price'
                }
              }
            }
          }

          // search term
          if (typeof term === 'string') {
            // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html
            body.query.bool.must = {
              'multi_match': {
                'query': term,
                'fields': [
                  'name',
                  'keywords'
                ]
              }
            }

            // handle terms suggestion
            // 'did you mean?'
            // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html
            body.suggest = {
              'text': term,
              'words': {
                'term': {
                  'field': 'name'
                }
              }
            }
          }

          // pagination
          // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html
          if (typeof from === 'number' && from > 0) {
            // offset
            body.from = from
          }
          if (typeof size === 'number' && size > 0) {
            // limit
            body.size = size
          } else {
            // default page size
            body.size = 24
          }

          // filters
          if (typeof specs === 'object' && specs !== null && Object.keys(specs).length > 0) {
            // nested ELS object
            // http://nocf-www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html
            for (var key in specs) {
              if (Array.isArray(specs[key]) && specs[key].length > 0) {
                // add filter
                body.query.bool.filter.push({
                  'nested': {
                    'path': 'specs',
                    'query': {
                      'bool': {
                        'filter': [
                          {
                            'term': {
                              'specs.grid': key
                            }
                          }, {
                            'terms': {
                              'specs.text': specs[key]
                            }
                          }
                        ]
                      }
                    }
                  }
                })
              }
            }
          }

          if (Array.isArray(ids) && ids.length > 0) {
            // add filter
            // search by product Object IDs
            body.query.bool.filter.push({
              'terms': {
                '_id': ids
              }
            })
          }

          // handle filter by categories and brands with IDs or names
          var filterFields = {
            'brands': brands,
            'categories': categories
          }
          for (var field in filterFields) {
            var filterVal = filterFields[field]
            if (Array.isArray(filterVal) && filterVal.length > 0) {
              if (/^[a-f0-9]{24}$/.test(filterVal[0])) {
                // filtering by ObjectID
                field += '._id'
              } else {
                // filtering by name
                field += '.name'
              }

              // add filter
              var filterObj = { 'terms': {} }
              filterObj.terms[field] = filterVal
              body.query.bool.filter.push(filterObj)
            }
          }

          // price ranges
          if (typeof prices === 'object' && prices !== null && Object.keys(prices).length > 0) {
            var rangeQuery = {
              'range': {
                'price': {}
              }
            }
            if (typeof prices.min === 'number' && !isNaN(prices.min)) {
              rangeQuery.range.price.gte = prices.min
            }
            if (typeof prices.max === 'number' && !isNaN(prices.max)) {
              rangeQuery.range.price.lte = prices.max
            }

            // add filter
            body.query.bool.filter.push(rangeQuery)
          }
        }

        /*
        msg = logHeader('INFO') +
          '\nQuery DSL' +
          '\n' + JSON.stringify(body)
        logger.log(msg)
        */
        runMethod(callback, endpoint, host, body)
      }
935667
protected function clearSortingList()
    {
        PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DEFAULT);
        PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC);
        PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_DESC);
        PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_END_ASC);
        PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_END_DESC);
    }
84114
async def remove_offer(self, **params):
		
		if params.get("message"):
			params = json.loads(params.get("message", "{}"))
		
		if not params:
			return {"error":400, "reason":"Missed required fields"}

		# Check if required fields exists
		cid = int(params.get("cid", 0))
		buyer_address = params.get("buyer_address")
		coinid = params.get("coinid")

		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass
	
		# Check if required fileds 
		if not all([cid, buyer_address]):
			return {"error":400, "reason":"Missed required fields"}
		
		# Try to find offer with account id and cid	
		offer = await self.get_offer(cid=cid, buyer_address=buyer_address, coinid=coinid)
		if "error" in offer.keys():
			return offer

		# Remove offer
		database = client[coinid]
		offer_collection = database[settings.OFFER]
		await offer_collection.delete_one(
							{"account_id":offer["account_id"],
							"cid":cid})
		return {"result": "ok"}
409664
public void clearOrderDetailsStore() {
    for (final Map<String, IRippleTradeTransaction> cache : rawTradeStore.values()) {
      cache.clear();
    }
    rawTradeStore.clear();
  }
1298493
@Override
	public void clearCache() {
		entityCache.clearCache(CommerceShippingMethodImpl.class);

		finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}
342955
def disable_caching(self):
        ""
        self.caching_enabled = False
        for c in self.values():
            c.disable_cacher()
478705
@Override
	public void clearCache() {
		entityCache.clearCache(CommerceOrderPaymentImpl.class);

		finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}
66636
@Override
	public void clearCache() {
		entityCache.clearCache(CommerceDiscountRuleImpl.class);

		finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}