V
V
v- death2015-08-17 22:51:01
PHP
v- death, 2015-08-17 22:51:01

Do I need to add routing to the cache?

Hello. Here I have such a huge routing (add about 70 more routes)

router := httprouter.New()
  /*
    :keyApi - апи ключ
    :login  - логин пользователя которого надо авторизовать
    :hash   - md5("/auth/:keyApi/:login/:hash") где :keyApi и :login заменены настоящими значениями
  */
  //Авторизация, регистрация, доступ//
  router.GET("/auth/:keyApi/:login/:hash", UserAuthViews)
  router.GET("/sekurity/:keyAPI", UserSekurity)
  router.POST("/auth/", UserAuth)
  router.POST("/registration", UserRegistration)
  //Война//
  router.GET("/Battles/Invasion/:keyApi/:token/:hash", BattlesInvasion)
  router.POST("/Battles/Invasion/new/:keyApi/:token/:hash", BattlesInvasionNew)
  router.GET("/Battles/Sanctions/:keyApi/:token/:hash", BattlesSanction)
  router.POST("/Battles/Sanctions/new/:keyApi/:token/:hash", BattlesSanctionNew)
  router.POST("/Battles/Sanction/newProtectorate", BattlesSanctionNewProtectorate)
  router.POST("/Battles/Sanction/newLegion", BattlesSanctionNewLegion)
  /******************************Груповые бои****************************************/
  router.GET("/battleground/:keyApi/:token/:hash", Battleground)
  router.GET("/battleground/main/:keyApi/:token/:hash", BattlegroundDispley)
  router.GET("/battleground/changeRole/:role/:keyApi/:token/:hash", BattlegroundChangeRole)
  router.GET("/battleground/start/:keyApi/:token/:hash", BattlegroundStart)
  router.GET("/battleground/ready/:keyApi/:token/:hash", BattlegroundReady)
  router.GET("/battleground/deseration/:keyApi/:token/:hash", BattlegroundDeseration)
  router.GET("/battleground/attak/:user_attak/:keyApi/:token/:hash", BattlegroundAttak)
  router.GET("/battleground/defense/:user_hospital/:keyApi/:token/:hash", BattlegroundHospital)
  router.GET("/battleground/defense/:user_defense/:keyApi/:token/:hash", BattlegroundDefeense)
  //Мисии//
  router.GET("/Missions/location/:keyApi/:token/:hash", MissionsLocation)
  router.GET("/Missions/location/:id/:keyApi/:token/:hash", MissionsLocationId)
  router.GET("/Missions/location/:id_location/:id_missions/:keyApi/:token/:hash", MissionsLocationOk)
  router.GET("/Missions/hq/:keyApi/:token/:hash", MissionHq)
  router.GET("/Missions/hq/ok/:hqId/:keyApi/:token/:hash", MissionOk)
  router.GET("/Missions/hq/delete/:hqID/:keyApi/:token/:hash", MissionDelete)
  router.GET("/Missions/hq/many/:hqID/:keyApi/:token/:hash", MissionMany)
  //Магазин техники//
  router.GET("/units/index/ground/:page/:keyApi/:token/:hash", UnitsGround)
  router.GET("/units/index/marine/:page/:keyApi/:token/:hash", UnitsMarine)
  router.GET("/units/index/aviation/:page/:keyApi/:token/:hash", UnitsAviation)
  router.GET("/units/index/unique/:page/:keyApi/:token/:hash", UnitsUnique)
  //Чёрный рынок//
  /*возвращает информацио о наёмниках*/
  router.GET("/Blackmarket/Mercenaries/:keyApi/:token/:hash", BlackmarketMercenaries)
  router.GET("/Blackmarket/Mercenaries/:id/:time/:keyApi/:token/:hash", BlackmarketMercenariesNew)
  router.GET("/Blackmarket/Saboteurs/:keyApi/:token/:hash", BlackmarketSaboteurs)
  router.GET("/Blackmarket/Saboteurs/newDiver/:diverId/:keyApi/:token/:hash", BlackmarketSaboteursNewDiver)
  router.GET("/Blackmarket/Saboteurs/newKazarm/:diverId/:keyApi/:token/:hash", BlackmarketSaboteursNewKazarm)
  router.GET("/Blackmarket/Laboratory/:keyApi/:token/:hash", BlackmarketLaboratory)
  router.GET("/Blackmarket/Laboratory/:id/:time/:keyApi/:token/:hash", BlackmarketLaboratoryNew)
  router.GET("/Blackmarket/Contraband/:keyApi/:token/:hash", BlackmarketContraband)
  router.GET("/Blackmarket/Contraband/:id/:keyApi/:token/:hash", BlackmarketContrabandNew)
  router.GET("/Blackmarket/Documents/:keyApi/:token/:hash", BlackmarketDocuments)
  router.GET("/Blackmarket/Documents/:ava/:flags/:keyApi/:token/:hash", BlackmarketDocumentsUpdate)
  router.GET("/Blackmarket/Auction/:keyApi/:token/:hash", BlackmarketAuction)
  router.GET("/Blackmarket/Auction/:gold/:keyApi/:token/:hash", BlackmarketAuctionUpdate)
  //Производство//
  router.GET("/Manufacturing/Factory/:keyApi/:token/:hash", ManufacturingFactory)
  router.GET("/Manufacturing/Factory/evolve/:keyApi/:token/:hash", ManufacturingEvolve)
  router.GET("/Manufacturing/Factory/NewEvolve/:units/:keyApi/:token/:hash", ManufacturingNewEvolve)
  router.GET("/Manufacturing/Factory/New/:keyApi/:token/:hash", ManufacturingNew)
  router.GET("/Manufacturing/Mines/:keyApi/:token/:hash", ManufacturingMines)
  router.GET("/Manufacturing/Mines/Sp/:keyApi/:token/:hash", ManufacturingMinesSp)
  router.GET("/Manufacturing/Mines/TerorAttak/:keyApi/:token/:hash", ManufacturingMinesTerorAttak)
  router.GET("/Manufacturing/Mines/SpContinue/:keyApi/:token/:hash", ManufacturingMinesSpContinue)
  router.GET("/Manufacturing/Mines/new/:keyApi/:token/:hash", ManufacturingMinesNew)
  //Постройки//
  router.GET("/Buildings/Profitable/:keyApi/:token/:hash", BuildingsProfitable)
  router.GET("/Buildings/Profitable/:id/:keyApi/:token/:hash", BuildingsProfitableNew)
  router.GET("/Buildings/Defense/:keyApi/:token/:hash", BuildingsDefense)
  router.GET("/Buildings/Defense/:id/:keyApi/:token/:hash", BuildingsDefenseNew)
  router.GET("/Buildings/Energy/:keyApi/:token/:hash", BuildingsEnergy)
  router.GET("/Buildings/Defense/:id/:keyApi/:token/:hash", BuildingsDefenseNew)
  //Клуб офицеров//
  router.GET("Officerscclub/Resling/:keyApi/:token/:hash", OfficerscResling)
  router.GET("Officerscclub/Roulette/:keyApi/:token/:hash", OfficerscRoulette)
  router.GET("Officerscclub/SpyInterrogation/:keyApi/:token/:hash", OfficerscSpyInterrogation)
  router.GET("Officerscclub/VeteransRiddle/:keyApi/:token/:hash", OfficerscVeteransRiddle)
  router.GET("Officerscclub/WallNewspaper/:keyApi/:token/:hash", OfficerscWallNewspaper)
  //Профиль//
  router.GET("/Profile/Info/:keyApi/:token/:hash", ProfileInfo)
  router.GET("/Profile/Info/:id/:keyApi/:token/:hash", ProfileInfoId)
  router.GET("/Profile/Skills/:keyApi/:token/:hash", ProfileSkills)
  router.GET("/Profile/Achievements/:keyApi/:token/:hash", ProfileAchievements)
  router.GET("/Profile/Property/:keyApi/:token/:hash", ProfileProperty)
  router.GET("/Profile/Booty/:keyApi/:token/:hash", ProfileBooty)
  router.GET("/Profile/Gifts/:keyApi/:token/:hash", ProfileGifts)
  router.GET("/Profile/VipMode/:keyApi/:token/:hash", ProfileVipMode)
  router.GET("/Profile/Statistic/:keyApi/:token/:hash", ProfileStatistic)
  //Зал славы//
  router.GET("/Halloffame/Rating/:keyApi/:token/:hash", HalloffameRating)
  router.GET("/Halloffame/Statistic/:keyApi/:token/:hash", HalloffameStatistic)
  router.GET("/Halloffame/Heroes/:keyApi/:token/:hash", HalloffameHeroes)
  router.GET("/Halloffame/Legions/:keyApi/:token/:hash", HalloffameLegions)
  //Альянс//
  router.GET("/Alliance/Index/:keyApi/:token/:hash", AllianceIndex)
  router.GET("/Alliance/Requests/:keyApi/:token/:hash", AllianceRequests)
  router.GET("/Alliance/Referrals/:keyApi/:token/:hash", AllianceReferrals)
  router.GET("/Alliance/Reinforcement/:keyApi/:token/:hash", AllianceReinforcement)
  router.GET("/Alliance/UnderDefense/:keyApi/:token/:hash", AllianceUnderDefense)
  //Чаты//
  router.GET("/Chat/Public/:keyApi/:token/:hash", ChatPublic)
  router.GET("/Chat/Alliance/:keyApi/:token/:hash", ChatAlliance)
  router.GET("/Chat/Legions/:keyApi/:token/:hash", ChatLegions)
  router.GET("/Chat/Bootcamp/:keyApi/:token/:hash", ChatBootcamp)
  //Банк//
  router.GET("/Bank/Storage/:keyApi/:token/:hash", BankStorage)
  router.GET("/Bank/Gold/:keyApi/:token/:hash", BankGold)
  router.GET("/Bank/Сredit/:keyApi/:token/:hash", BankСredit)
  router.GET("/Bank/Exchanger/:keyApi/:token/:hash", BankExchanger)
  //Почта//
  router.GET("/Mail/Index/:keyApi/:token/:hash", MailIndex)
  router.GET("/Mail/Write/:keyApi/:token/:hash", MailWrite)
  router.GET("/Mail/Contacts/:keyApi/:token/:hash", MailContacts)
  router.GET("/Mail/Ignore/:keyApi/:token/:hash", MailIgnore)
  //Новости//
  router.GET("/News/:keyApi/:token/:hash", News)
  router.GET("/News/AddCommen/:keyApi/:token/:hash", NewsAddCommen)
  //Ежедневный бонус//
  router.GET("/dailyBonus/:keyApi/:token/:hash", dailyBonus)
  //Системные вызовы//
  router.GET("/system/migration", SystemMigration)

On any php framework / class, you need to add such routing to the cache, otherwise the server will crash from 100 requests.
How about this in golang? or the compiler compiles so that it is not necessary to throw it into the cache?
If you need to add to the cache, how?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-08-17
@vGrabko99

go to the documentation for the selected router:
That is, this thing, based on these rules, builds a tree that will lie in memory as long as your application lives.
In PHP, the cache is necessary, since the PHP application dies after each request, and if there were no cache, then the parsing of this good would occur on each request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question